Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

JS doesn't support splice


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.


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).


You can slice the array to a global one inside the function:
var sprez;
function splice_to_sprez(myarray)