Skip to content

Instantly share code, notes, and snippets.

@linkgod
Last active December 21, 2015 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linkgod/6289733 to your computer and use it in GitHub Desktop.
Save linkgod/6289733 to your computer and use it in GitHub Desktop.
changes arguments to "true" array
var argsArr = Array.prototype.slice.call(arguments);
// changes arguments to "true" array
// 把 arguments 转换成一个“真正的”数组
var nodesArr = Array.prototype.slice.call(document.querySelectorAll("div"));
// "true" array of DIVs
// 得到一个由 div 元素组成的“真正的”数组
// document.querySelectorAll("div")得到的不是一个类数组
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment