I am storing my array as a mixture of array an array and an object. For example assume this one:
let arrObj = [];
arrObj["x"] = 12;
arrObj.push(12);
arrObj["y"] = 15;
arrObj.push(15);
// result: arrObj = [12, 15, x: 12, y: 15]
so that, I can access the value 12 even using arrObj[0] and arrObj["x"]. And this way, I can do a repeat for on it.
But when I stringify it, the keys x and y get lost:
JSON.stringify(arrObj)
// result: "[12,15]"
How should I maintain those keys and their values?
"[ 12, 15, 'x': 12, 'y': 15 ]". Even if you output it, you won't be able to parse it as JSON. So it's not clear how this could work without some sort of transformation.[...arrObj.values()] // [12, 15]is the actual result. Dont confuse with x and y. They are just properties ofarrObjarray