JS doesn't support splice


#1

I made a ticket on GitHub for this, but I’m curious that nobody has noticed. It’s how to insert into arrays in JS at a specific index (as opposed to push which appends at the end of the array). I have to alter my code rather significantly and sort it at a later time in order to get around this bug.


#2

I updated your ticket–splice doesn’t return the array. It doesn’t work properly in a nested function to update an array that you use outside the function, but other than that, it works (so most of the time).


#3

You can slice the array to a global one inside the function:
var sprez;
function splice_to_sprez(myarray)
{
enemies.splice(0,1);
sprez=myarray.slice();
}