Simple Stack Example : JavaScript DHTML examples (example source code) » Language Basics » Stack

JavaScript DHTML
C++
Java Products
Java Articles
JavaScript DHTML Home  »   Language Basics   » [  Stack  ]   
 



Simple Stack Example

Please note that some example is only working under IE or Firefox.

/*

Learn How to Program Using Any Web Browser
by Harold Davis 

Apress CopyRight 2004

ISBN: 1590591135
*/
<HTML>
<HEAD>
<TITLE> 
Simple Stack Example 
</TITLE>
</HEAD>
<BODY>
<H1>
<SCRIPT
var stack = new Array()
stack.push("Me""Two")
for (var i = 0; i < stack.length; i++){ 
   document.write(stack[i"<br>")

document.write (stack.pop() "<br>")
for (var i = 0; i < stack.length; i++){ 
   document.write(stack[i"<br>")

</SCRIPT>
</H1>
</BODY>
</HTML>
Related examples in the same category
1.   Pushing, Popping, and Displaying the Contents of a Stack








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.