Push (): Adds an element after the array and returns the length of the array;
Unshift (): In front of the array is like an element, and returns the length of the array;
Pop (): Deletes the last element;
var arr =[1,2,3,4,5];
Arr.push (6,7,8);
Console.log (arr);//push: The result of adding an element after the array is: [1,2,3,4,5,6,7,8]
Arr AA = [7,8,9,0];
Aa.unshift (4,5,6);
Console.log (AA);//unshift: The result of adding an element before the array is: [4,5,6,7,8,9,0]
var arr = [1,2,3,4,5];
Console.log (Arr.push (6)); The direct console, which returns the length of the array, is 6
var AA = [9,0];
Console.log (Aa.unshift (5)); The direct console, which returns the length of the array, is 3
Pop () Delete last element
var arrdele =[1,2,3];
Console.log (Arrdele.pop ());//returns the last element and deletes
Console.log (Arrdele);
Arrdele.pop ();//Delete last element
Console.log (Arrdele);//Returns an array
Shift () deletes the first element
var Delearr =[1,2,3,4];
Console.log (Delearr.shift ());//returns the first element and deletes
Console.log (Delearr);
Delearr.shift ();//Delete First element
Console.log (Delearr);
Common methods of JS array operation