把arguments转化成数组

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)

 

posted @ 2012-06-19 11:10  小猩猩君  阅读(5764)  评论(1编辑  收藏  举报