For loop can be ++i from 0, can also from the largest number, has been-I, can!!!
A For loop is nested inside a For loop:
Outside the ++i into the inside, inside the for loop after a cycle, in the jump to the outside, continue to ++i!
(Parent for loop one number, child for loop one cycle)
The same code needs to be copied and pasted, that is, the code needs to be optimized!
Set a small goal: Important code stick to write comments, density of about 3 lines one!
Array Meaning: A collection of many data (values/variables)!
Define à action (add modification) à use
var arr = []; --Define the way (generally using the same data type)!
Array elements: Each value in [] is called an array element!
Array subscript (Index): The position of the specified array element in the array (note that it starts at 0)!
Array Length: Number of array elements (ARR.LENGTH)!
Take the array element: arr. [Array subscript]
Arr.push= (arr.length);
--Add an array element of array length (plus the previous length is a few, this array element is a few)!
After the development of code, the value of the variables may not be known, the variables stored in what data must be clear!!!
Console.log (Shuzu[shuzu.length-1]);
--Always output the last variable (shuzu.length-is not possible, only can-number)!
Join ()//array to string
Add Delete for push () and pop ()///End
Shift () and unshift ()//Add Delete for first element
Sort ()//Sort (1 3 2 4à1 2 3 4)
Reverse ()//Invert
Concat ()//connection array ([1,2][3,4]à[1,2,3,4])
Slice ()//delete the element at the specified position
Splice ()//delete the element at the specified position
IndexOf () and LastIndexOf ()//Find element (this element is not inside this array, if in, returns a subscript)!
Array traversal: Take out every number in the array to do something (make a visit and do it only once)!
For and array traversal
For-in and Array traversal
One-dimensional arrays/two-D arrays/multidimensional arrays!
2018-06-15for with arrays/for-in and arrays/one-dimensional two-dimensional multidimensional arrays