For map, many of the partners in the array may often confuse and use a vague concept, and I'll summarize my own experience here:
Array:
Generally we create this:
var arr = new Array ();
or direct: var arr = [];
Then operate on the array:
1, add elements:
var obj = ' The element you want to add ';
Arr.push (obj);
2, find the element:
var obj = ' You need to find the element ';
Arr.indexof (obj); The return value is-1, which means that obj does not exist in this array, and if not, returns the position of the element in the array, starting with 0.
3, delete the element:
Arr.pop ()//delete and return the last element
For example: var arr = [n/a]; var B = Arr.pop (); As a result, b = 3,arr = [+];
Arr.shift ()//delete and return the first element
Arr.splice (index,1)//delete the next 1 elements starting from the index position
var arr = [1,2,3,4,5];
For example: Arr.splice (2,2)//return [3,4],arr = [1,2,5]
Map creation:
var map = {};
To add an element:
For example, add: name = 1;
map[' name ']=1;
JS creates a new map object and operates on it