<script
type="text/javascript">
var numbers =
["one", "two", "three", "four"];
numbers.unshift("zero");
document.write("
"+numbers.shift());
document.write("
"+numbers.shift());
document.write("
"+numbers.shift());
</script>
This produces
zero one two
shift, unshift, push, and pop
may be used on the same array. Queues are easily implemented using
combinations.
No comments:
Post a Comment