I tried replacing my elements specifically with an object. But it is just adding up like a push and making the array longer.
let arr = [];
function addToArray(index){
let comment = value;
let score= scoreType;
let scorenow = score;
let id = id;
arr.splice(index,0,{comment,score,scorenow ,id });
}
I am figuring out a way to insert this object only to the index of arr.
Example : addToArray(2) should return a [undefined,undefined,{comment,score,scorenow,id}]