I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
0 1 2 3 4 5 // indexes
4 5 1 9 8 1 // numbers at those indexes
first i is equal to 0, the check fail, and the item at index 0 is removed:
0 1 2 3 4
5 1 9 8 1
now it's time for index 1, and arr[i] is now 1
notice what happen? the 5 is impossible to remove, as it’s being jumped over
It’s all good, @ILM.
Rather than just use: arr.splice(1,4), I’m determined to figure out the pseudocode and iterate through the array, to further my understanding. So, don’t tell me yet. I’ll post it here when I do