With the Array methods push(), pop(), unshift() and shift(), you can build various stacks and queues.
A First In Last Out stack can be constructed with push() and pop(). This works from the end of the array.
An alternative FILO stack can be constructed with unshift() and shift() but that will operate at the start of the array.
Prev | Home | Next |
SSJS | Up | Standalone JavaScript |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |