How to set Id product as key in Array JavaScript? [duplicate]

I have an array, which contains objects. Key of element is ID of “some” model. Example of array:
[null, null, null, null, ... {text: simple, type: 'class'}]

In my case I have id 3081, that means element should in 3081 index.

An array put in “some” object, which should convert to JSON. I am doing next operation:

const json = {
 data: 'simple',
 status: 'ok',
 exampleArray: [null, null, null, null...{text: simple, type: 'class'}]
} 

JSON.stringify(json)

In browser, I got next picture, that I included in attached. All elements is null, until we found 3081 index, that is our object.

Can we remove all nulls in array or this is specific for JS?

enter image description here