Where .pop() removes the last item, .shift() however removes the first item. Please note that:
routePieces.shift();
...would be the appropriate way to update routePieces and not
routePieces = routePieces.shift();
...which behaves badly.
Addendum 12/14/2018: The variable assignment above will get the item removed by the .shift() operation I think.
No comments:
Post a Comment