Array.from() 将类数组转数组
Array.of() 创建数组
// Array.from() const divs = document.getElementsByTagName(‘div‘) Array.from(divs).forEach(v => { console.log(v) }) // Array.of() const arry = Array.of(1,2,3)
copyWithin(pos,start,end) // pos黏贴位置, start复制的起始位置, end 复制的结束位置
find() findIndex()
entries() keys() values()
flat() flatMap()
// 实现copyWithin() Array.prototype.myCopyWithin = function(pos,start,end){ return this.splice(pos,end-start+1,...this.slice(start-1,end)),this } const arry = [0,1,2,3,4,5,6,7,8,9] console.log(arry.copyWithin(3,4,8)) console.log(arry.myCopyWithin(3,4,8))
splice(pos,count,a1,a2,a3)
原文:https://www.cnblogs.com/LunuZ/p/15125717.html