JS CODE =>
let arr = [1,2,3,‘dasdas’];
arr.shift();
console.log(arr);
console.log(arr[0]);
arr.unshift(“sdsa”,1);
console.log(arr);
OUTPUT =>
sdsa,1,2,3,dasdas
2
sdsa,1,2,3,dasdas
Why am i getting this output shouldn’t the ouput be this =>
2,3,dasdas // < = CHANGED
2
sdsa,1,2,3,dasdas
On using index i am getting the right anwer .
Why is this happening ?