Create grammar
var array1=new Array();
array1[0]=1;
array1[1]="2";
var array1=new Array(1,"2");
var array1=[1,"2""];
Array object methods
method | description |
---|---|
concat() | Concatenate two or more arrays and return the result |
every() | Check whether each element of the array element meets the condition |
filter() | Detect array elements and return an array of all elements that meet the condition |
indexOf() | Search for the element in the array and return its position |
join() | Put all the elements of the array into a string |
lastIndexOf() | Returns the position of the last occurrence of a specified string value, searching backward from the specified position in a string |
map() | Use the specified function to process each element of the array and return the processed array |
pop() | Delete the last element of the array and return the deleted element |
push() | Add one or more elements to the end of the array and return the new length |
reverse() | Reverse the element order of the array |
shift() | Delete the first element of the array |
slice() | Select part of an array and return a new array |
some() | Check if any of the elements in the array meet the specified conditions |
sort() | Sort the elements of the array |
splice() | Add or remove elements from the array |
toString() | Convert the array to a string and return the result |
unshift() | Add one or more elements to the beginning of the array and return the new length |
valueOf() | Returns the original value of the array object |
Array object learning mind map
Excerpt from W3Cschool .