function list() {
//两者皆可将类数组对象装换为数组
// return Array.prototype.slice.call(arguments);
return [].slice.call(arguments)
}
var list1 = list(1, 2, 3); // [1, 2, 3]
console.log(list1)
console.log(Object.prototype.toString.call(list1)) // [object Array]
将类数组对象转换为数组
最新推荐文章于 2023-03-06 10:44:02 发布