Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How to make a array as a stack using JavaScript?
How to make a array as a stack using JavaScript?
✍: Guest
The pop() and push() functions turn a harmless array into a stack:
<script type="text/javascript">
var numbers = ["one", "two", "three", "four"];
numbers.push("five");
numbers.push("six");
document.write(numbers.pop());
document.write(numbers.pop());
document.write(numbers.pop());
</script>
This produces:
sixfivefour
2011-07-26, 4048👍, 0💬
Popular Posts:
Why does malloc(0) return valid memory address? What's the use? malloc(0) does not return a non-NULL...
What is the purpose of finalization? The purpose of finalization is to give an unreachable object th...
What is the concept of XPOINTER? XPOINTER is used to locate data within XML document. XPOINTER can p...
What is the difference between strings and character arrays? A major difference is: string will have...
When should the method invokeLater() be used? This method is used to ensure that Swing components ar...