Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么要包含原型?
为什么不呢?
Array.slice.call()
因为Array是一个函数,而函数没有.slice方法,只有数组有。
Array
.slice
更好地检查文档,这可以帮助你http://shifteleven.com/articles/2007/06/28/array-like-objects-in-javascript
Array是一个构造函数,不包含slice方法。它的原型 ( Array.prototype) 可以。但是,您可以slice从(空)Array实例调用:
slice
Array.prototype
[].slice.call(/*...*/)