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)

 

相关文章: