Push object into array without key in javascript

I want to push my object without a key in my javascript array. Right now the issue is I psuh my object in the array, but I add extra key 0,1,2 … I don’t want that key. Is there any solution for that? Here I add the code that I implemented.

let newArr = [];
let myId = data['id'];
var key = myId;
var obj = {};
myobj[key] = {
  data: "testdata"

The above code generates output like below. I don’t want that 0 key in my array

0: { 
    260: {
        data: 'testdata'

26 thoughts on “Push object into array without key in javascript”

Leave a Comment