# Object disorder in JavaScript

As you already know, in arrays, the elements are arranged in a strict order, because the position of each element determines its key. In objects, we assign the keys ourselves, so the order of the elements does not matter. That is, arrays are ordered lists, while objects are not.

For example, consider the following object:

`let obj = {1: 'a', 2: 'b', 3: 'c'}; console.log(obj[1]); // shows 'a' console.log(obj[2]); // shows 'b' console.log(obj[3]); // shows 'c'`

If we rearrange the elements of this object in an arbitrary order (of course, along with their keys), then nothing will change in the work of our script:

`let obj = {3: 'c', 1: 'a', 2: 'b'}; console.log(obj[1]); // shows 'a' console.log(obj[2]); // shows 'b' console.log(obj[3]); // shows 'c'`

Also, numeric keys do not need to have all values without holes, like an array. We can have arbitrary numbers and it won't lead to any problems (like sparsity in arrays). Therefore, the following object is correct:

`let obj = {7: 'a', 50: 'b', 23: 'c'};`

Create an object and make sure the order of the keys in it doesn't matter.

← →
↑
en ru