DEV Community

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

Posted on

3 1

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

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

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay