1

This is from MDN

const object1 = {
  a: 'somestring',
  b: 42,
  c: false
};

console.log(Object.keys(object1));
// expected output: Array ["a", "b", "c"]

OK

but why

const object1 = {
  "8": 'somestring',
  "4": 42,
  "2": false
};

console.log(Object.keys(object1));
// expected output: Array ["2", "4", "8"]

Why we don't have Array ["8","4","2"] ?

Many thanks in advance

0 Answers0