参考
http://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array
Array.from()
Array.isArray()
Array.of()
Array.prototype.concat()
Array.prototype.copyWithin()
Array.prototype.entries()
Array.prototype.every()
Array.prototype.fill()
Array.prototype.push()
Array.prototype.pop()
Array.prototype.shift()
Array.prototype.unshift()
Array.prototype.splice()
Array.prototype.split()
Array.prototype.sort()
Array.prototype.reverse()
Array.prototype.slice()
Array.prototype.forEach()
Array.prototype.map()
语法
var newArray = arr.map(callback(element[, index[, array]])[, thisArg])
示例
1
2
3
4var filtered = [1, 4, 9, 16].map(element => {
return element * 2
})
→ [2, 8, 18, 32]
Array.prototype.filter()
语法
var newArray = arr.filter(callback(element[, index[, array]])[, thisArg])
示例
1
2
3
4var filtered = [12, 5, 8, 130, 44].filter(element => {
return element >= 10
})
→ [12, 130, 44]