var foo = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
How would you turn the above into something like below?
var rev = [0, 1, 5, 4, 3, 2, 6, 7, 8, 9];
As you can see rev
is only partially reversed. The reverse operation started at index 2
and ended at index 5
Just to make the end result clearer to see:
var foo = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var rev = [0, 1, 5, 4, 3, 2, 6, 7, 8, 9];