JavaScript把数组作为堆栈使用的代码范例,支持堆栈常用的push和pop方法
<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>