I'm having an issue to shift a split text array
let text = "Hello world";
console.log(text.split(" ").shift()) // Hello
It gives me Hello instead of world
This is because the Array.prototype.shift() function removes the first element of the array as expected AND returns it. That's why you get "Hello". To get "world", you need to do text[1] .
Have a great day, Lukas Laudrain.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift