I was trying to use the splice() function to manipulate an array of integers. But all I am getting is strange results.
Here is my code
var g = [0,1];
//Expected result [0, 1, 1]
//Actual result [0]
console.log(g.splice(0, 1, 0, 1));
//Expected result [0,5]
//Actual result [1]
console.log(g.splice(1, 1, 5));
Can any of you help me understand the usage of splice on integer array?
Thanks in advance.