Javascript知识点

Javasscript

[ES5]array.reduce() 可以用来扁平数组,对数组做累加操作

[0,1,2,3,4].reduce(function(previousValue,currentValue, index, array){
 return previousValue + currentValue;
});
var flattened = [[0, 1], [2, 3], [4,5]].reduce(function(a, b) {
 return a.concat(b);
});
// flattened is [0, 1, 2, 3, 4, 5]

[ES6] array.copyWithin

你可能感兴趣的:(Javascript知识点)