0

Why to include a prototype?

Why just not?

   Array.slice.call()

3 Answers 3

1

Array is a constructor function and doesn't contain a slice method. It's prototype (Array.prototype) does. You can however call slice from an (empty) Array instance :

[].slice.call(/*...*/)
Sign up to request clarification or add additional context in comments.

Comments

1

Because Array is a function and functions don't have a .slice method, only arrays do.

Comments

1

Better check documentation ,this could help you http://shifteleven.com/articles/2007/06/28/array-like-objects-in-javascript

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.