常见的类数组结构 发表于 2020-06-08 argumentsNodeList如何转为数组结构 数组的slice方法: 123456// arguments, NodeListArray.prototype.slice.call(ArrayLike)// 是要有length属性,都可以调用slice方法;无length则返回空数组obj = { '0': 0, 1: 1, 2: 2, length: 4 }Array.prototype.slice.call(obj) // [0, 1, 2, empty] Array.from方法 12Array.from(arguments)Array.from(document.querySelectorAll('div')) 扩展运算符 12[...arguments][...document.querySelectorAll('div')]