numberic as object key, value as array [closed]

Your object structure is incorrect. You need to put 1 and 2 on the same level of object ob:

const ob = {
  "1": [{
    "name": "destination"
  }],

  "2": [{
    "name": "destination"
  }]
};
console.log(ob['1']);
console.log(ob['2']);

Leave a Comment