把arguments转化成数组

mac2022-06-30  22

1 (function(){ 2 console.log(arguments instanceof Array); // false 3 var argsArray = Array.prototype.slice.call(arguments); 4 console.log(argsArray instanceof Array); // true 5 }());

 

getElementsByTagName返回的NodeList也可以转化成数组

1 Array.prototype.slice.call(nodes)

 

转载于:https://www.cnblogs.com/qzsonline/archive/2012/06/19/2554513.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)