I have hit a strange wall. The splice() method is behaving differently from what was explained.
Please take a moment to read the code below.
Console.log(newArray) is only returning one value and I cannot figure out why.
Console.log(newArray2) is returning two values, the first value is the correct ZBI(zero base index), however the second value is not.
May you please explain why, (newArray) is returning only a single value and why (newArray2) is also splicing at the wrong ZBI?
let array = ['I', 'am', 'feeling', 'really', 'happy']; let array2 = ['Merry', 'Xmas', 'Everyone', 'And', 'Happy--'] let newArray = array.splice(3, 1); let newArray2 = array2.splice(3, 2); console.log(newArray); console.log(newArray2);