Edit: total simplification.
Consider this code:
let arr = [42,69]
arr.key = 'lol'
It creates a key value to an array.
However, is it possible to write those two lines in one? I can't find a syntax that works and I'm not sure it is possible.
The reason I want this is because I push the array into another array. I could use an object, but I plan to pop items from it later and it doesn't work on objects.
let all = []
all.push({'0':42,'1':69,'key':'lol'})
{key : val}or store the key in the item in the array - again with an objectmyarray = [{name: "item", key: 500},{name:"item 2", key:501}]pickedrocks[0].key = 500works perfectly fine.