DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for The Difference Between Arrays and Objects(simplest explaination).
Mahendra Bishnoi
Mahendra Bishnoi

Posted on

The Difference Between Arrays and Objects(simplest explaination).

In JavaScript, arrays use numbered indexes.

In JavaScript, objects use named indexes.

Arrays are a special kind of objects, with numbered indexes.

When to Use Arrays. When to use Objects.

  1. JavaScript does not support associative arrays.
  2. You should use objects when you want the element names to be strings (text).
  3. You should use arrays when you want the element names to be numbers.

Top comments (2)

Collapse
 
prakh_r profile image
Prakhar Yadav

sweet quick notes πŸ₯‚ We need more of these

Collapse
 
browncoder profile image
Mahendra Bishnoi Author

glad you liked it .. more are coming on important topics 😊

🌚 Life is too short to browse without dark mode