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 8457409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:48:00+00:00 2026-06-10T12:48:00+00:00

Possible Duplicate: Array-like object in javascript Javascript has native objects that are array-like objects

  • 0

Possible Duplicate:
Array-like object in javascript

Javascript has native objects that are array-like objects (eg. arguments, NodeList).

I would like to know:

  1. What are the advantages of creating an array-like object?
  2. When should be a good idea to create an array-like object (rather than create a regular array object)?
  • 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-06-10T12:48:01+00:00Added an answer on June 10, 2026 at 12:48 pm

    You’re looking at it from the wrong side: the early versions of Java(Live)Script didn’t have arrays, only objects. An array, in fact, is an augmented objects (indeces are converted to strings internally!). So an Array is an Object, like arguments is an object… there are some overlaps, some differences…

    To answer your question: you can never really make an arguments object, that’s just inherent to functions and you should treat them as read-only objects.

    NodeLists are objects, returned by stuff like document.getElementsByTagName('a');, the advantage of them is that (except for IE, of course) they come with a couple of neat methods:

    var inputs = document.getElementsByTagName('input');
    var userNameIn = inputs.namedItem('username');//Arrays don't have this
    

    So when should you use what? Well, dealing with nodes: 9 times out of 10 you’re best served with a nodes list, arguments objects are what you need inside functions. Since JS is a functional language, you need them a lot.
    That said, it really doesn’t matter that much: chances are you’ve come across code like this:

    var myArgs = Array.prototype.slice.apply(arguments,[0]);
    

    This just borrows the slice method from the Array prototype and calls it as if it were a method of the arguments object.
    That’s all there is to say, really. There is no definitive answer here, just that old mantra: go with your gut feeling. Try, fail, learn and try again.

    Just know that, whatever you do, you can borrow prototype (or even instance) methods, and that everything traces back to the mother Object.prototype prototype.

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

Sidebar

Related Questions

Possible Duplicate: Length of Javascript Associative Array I have a JSON that looks like
Possible Duplicate: How to sort an array of javascript objects? I have output that
Possible Duplicate: PHP get all arguments as array? Within a javascript function arguments always
Possible Duplicate: How to sort an array of javascript objects? Every time I mess
Possible Duplicate: Javascript swap array elements I have a array like this: this.myArray =
Possible Duplicate: How to sort an array of javascript objects? Well, more preciselly, I
Possible Duplicate: php sort array by sub-value I have a multidimensional array like the
Possible Duplicate: php multi-dimensional array remove duplicate I have an array like this: $a
Possible Duplicate: How do I test for an empty Javascript object from JSON? Is
Possible Duplicate: Getting JavaScript object key list How to iterate json data in jquery

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.