Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6170913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:07:21+00:00 2026-05-23T23:07:21+00:00

I was reading the MDN page for the JS Function’s arguments variable: https://developer.mozilla.org/en/JavaScript/Reference/Functions_and_function_scope/arguments I

  • 0

I was reading the MDN page for the JS Function’s arguments variable:

https://developer.mozilla.org/en/JavaScript/Reference/Functions_and_function_scope/arguments

I understand that arguments is not an Array so this won’t work:

var a = arguments.slice();

The solution on MDN is do do this:

var args = Array.prototype.slice.call(arguments);

Why use Array.prototype and not just Array.slice.call(arguments)? Is using the prototype significant here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:07:22+00:00Added an answer on May 23, 2026 at 11:07 pm

    Why use Array.prototype and not just Array.slice.call(arguments)?

    The Array.slice method is part of the Array and String Generics, a set of “static” methods implemented as properties of the Array and String constructors.

    Those methods are non-standard, they are available just in Mozilla-based implementations.

    I’ve seen a lot confusion between those methods and the standard ones, but you should know that they aren’t the same, if you test:

    Array.slice === Array.prototype.slice; // false
    

    You will find that they are different methods.

    And by the way, if you where using that method, you don’t need to use the call method, the first argument is the object that will be used as the this value (Array.slice(arguments)).

    Is using the prototype significant here?

    Yes, the Array constructor is just a function, the standard slice method, and all the other “array methods” are defined on Array.prototype.

    This object, Array.prototype, is the one in which all Array object instances inherit from.

    As @Pointy says, you could get a reference to the method using an Array instance:

     [].slice === Array.prototype.slice; // true
    

    This, in theory, will create a new Array object, and access the slice method up in the prototype chain, but I remember that some implementations are starting to optimize this kind of property access, avoiding the creation of the disposable object, so, at some point, it will be exactly the same also talking in terms of performance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading through this question on multi-threaded javascript, I was wondering if there would be
reading pylons documentations I did understand that websetup:setup_app is only called when the application
Reading section 9.1 of OAuth Core 1.0, I only see a reference to performing
Reading lines in a foreach loop, a function looks for a value by a
Reading and writing of a single variable is atomic (language guarantee!), unless the variable
Reading this Perl: extract rows from 1 to n (Windows) I didn't understand the
Reading this: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions What does it mean to add a 'member route'? or do
Reading through this , I came to the bit on default values for function
Reading this question I found this as (note the quotation marks) code to solve
Reading an article called Increase LINQ Query Performance in July's MSDN magazine, the author

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.