First of all, thanks to dash , I don't have to look around for documents anymore.
Thanks again for the eclipse, let me see the world's beauty
Okay, let's get to the point.
Note All My learning experiences are based on ECMASCRIPT5.
IE9 prior to the browser is not responsible
The JavaScript array is a fun object
How to test her? First of all, instanceof is a good way.
if (value instanceof Array) {}
But according to JavaScript high-level programming says this if a person reconstructs the array function you're done.
So
if (Arrays.isarray (value)) {}
Now we're going to construct the
But what's the point of doing that?
Actually, I'm concerned about the same type of construction.
var arr1 = [];var arr2 = new Array (), var arr3 = Array (); alert (typeof arr1); alert (typeof arr2); alert (typeof ARR3);
Okay, it's all object types.
We all know there's a length attribute in the array, so is she reliable?
var fruits = [];fruits.push (' banana ', ' apple ', ' peach '); Console.log (fruits.length); 3fruits[5] = ' mango '; Console.log (fruits[5]); ' Mango ' console.log (object.keys (fruits)); [' 0 ', ' 1 ', ' 2 ', ' 5 ']console.log (fruits.length); 6
It's only 4 elements that return 6.
Now I'm trying to modify the length property
Fruits.length = 2;console.log (Object.keys (fruits)); [' 0 ', ' 1 ']console.log (fruits.length); 2
What about my previous data?
Look at Array.Length, it's actually writable.
Two effects
Loop array similar to foreach
Eliminate unwanted arrays ... You should change it.
JavaScript Array Learning