+ 3
WHY pop method reverse the order ?
3 Réponses
+ 4
Think it through step by step in your mind:
If you always take the last element and then string them up again, you are reversing the list yourself!
abcde
e abcd
ed abc
edc ab
edcb a
edcba
+ 2
It remove the last element .but why ut reverse the order?
0
Because pop takes the last element out of an array.
Of you want the first element instead, take shift instead!