JavaScript array functions map ()

JavaScript array functions map () learning experience

map () function is a function of the array;

Each array element of its original operation, the operation does not empty array;

Does not change the original list, returns a new array;

arr.map(function(item,index,arr){

 

},thisValue);

item is a must, the other is not required, the function return is not required, it will automatically return item

thisValue is optional, the object used as the callback, passed to the function, as the value of "this".
If you omit the thisValue, or pass null, undefined, then the callback function of this global object.

Guess you like

Origin www.cnblogs.com/158cm/p/11375145.html