1 Array to string
You need to concatenate an array element with a character into a string, the sample code is as follows:
var A, b;a = new Array (0,1,2,3,4), B = A.join ("-");
Second, string to array
The implementation method is to cut a string into several strings by one character and return as an array, with the sample code as follows:
var s = "abc,abcd,aaa";
SS = S.split (",");//decomposition at each comma (,).
POP Delete last item
Deletes the last item and returns the value of the deleted element, or returns Undefine if the array is empty
shift Deletes the first item
Deletes the first item of the original array and returns the value of the deleted element; Returns undefine if the array is empty
push is added to the last
and returns the new array length;
Unshift added to the front
and returns the new array length;
Reverse Array Rollover
and returns the original array after flipping the original array, flipping the
indexof array Element index
and returns the element index, no return-1, index starting from 0
Slice intercept (slice) array to get intercepted array
Returns a new array of entries from the original array specifying the starting index (contained) to the end index (not included), the original array of wood changes, index starting from 0
Splice splicing array The original array changes can be implemented shift before deletion, pop after deletion, unshift before the increase, with push after the same effect
Returns the array of elements of the splice, the original array changes, and the index starts at 0
Concat Array Merging
Returns the merged new array, the original array of wood changes
A common method for converting a method array to a string with a JS array