@angristan Do not assign the output of Array.splice().
foo = [];foo.splice(0,0,'a');console.log(foo); // ['a']