3

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

2 Answers 2

3
var foo = [1,2,3];
foo.pop();
answered Nov 2, 2010 at 6:14
Sign up to request clarification or add additional context in comments.

Comments

2

Javascript has a pop function: http://www.w3schools.com/jsref/jsref_pop.asp

answered Nov 2, 2010 at 6:13

2 Comments

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/…
Also, to complete the airhead moment, I was looking for shift(). :S Time for bed I guess.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.