Is there a nifty trick for PHP's array_pop() in Javascript?
In lieu of any niftiness, I will accept elegance and/or brevity.
asked Nov 2, 2010 at 6:12
Ben
57.6k50 gold badges187 silver badges229 bronze badges
2 Answers 2
var foo = [1,2,3];
foo.pop();
answered Nov 2, 2010 at 6:14
Matthew
48.5k11 gold badges90 silver badges101 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Javascript has a pop function: http://www.w3schools.com/jsref/jsref_pop.asp
answered Nov 2, 2010 at 6:13
Logan Bailey
7,1677 gold badges38 silver badges45 bronze badges
2 Comments
Quentin
While that page covers the salient points, it does so with bad examples and masses of advertising. W3Schools is very low quality through out (often having massive security problems with its tutorials) so please don't link to it. MDC is usually a much better JS reference: developer.mozilla.org/en/JavaScript/Reference/Global_Objects/…
Ben
Also, to complete the airhead moment, I was looking for
shift(). :S Time for bed I guess.default