| Viewed 140 times

Difference between array and object in javascript

What is the difference between array and object in javascript

1 Answer
Mohammad Qandeel

First, you need to know what is an object in JavaScript, its a  data type that contains names or keys and values, represented in name:value.

In JavaScript, arrays use numbered indexes but the Objects use named indexes.

That's mean Arrays are a special kind of object, with numbered indexes.

you need to know that JavaScript does not support associative arrays.

now look to how to create Object in JavaScript

const parson= {
    name: "Qandeel",
    color: "green"

Related Questions