Queue manipulation (Useful tip)

With the enhanced array manipulation tools of JavaScript, you can build queue managers.

With the Array object methods push(), pop(), unshift() and shift(), you can build various stacks and queues.

'First In First Out' queues can be built with either unshift() and pop() or push() and shift() depending on which direction you want the objects to be queued in.

These capabilities have been available in Netscape since version 4, but are only available in MSIE at version 5.5, having been added to gain ECMA edition 3 compliance.

See also:Array.pop(), Array.push(), Array.shift(), Array.unshift(), Stack manipulation

insert figure 0103

insert figure 0104

insert figure 0105

insert figure 0108