13th Mar 2019, 9:24 AM
SHAHMIR FAISAL
SHAHMIR FAISAL - avatar
3 Answers
+ 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
13th Mar 2019, 9:35 AM
HonFu
HonFu - avatar
+ 2
It remove the last element .but why ut reverse the order?
13th Mar 2019, 9:33 AM
SHAHMIR FAISAL
SHAHMIR FAISAL - avatar
0
Because pop takes the last element out of an array. Of you want the first element instead, take shift instead!
13th Mar 2019, 9:32 AM
HonFu
HonFu - avatar