案例:JavaScript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<body>
3
4
<script type="text/javascript">
5
6
Array.prototype.enqueue = function(vItem) {
7
  this.push(vItem);
8
};
9
10
Array.prototype.dequeue = function() {
11
  return this.shift();
12
};
13
14
var arr = new Array(3)
15
arr[0] = "George"
16
arr[1] = "John"
17
arr[2] = "Thomas"
18
19
arr.enqueue("Bill");
20
document.write(arr);
21
22
document.write("<br />")
23
24
arr.dequeue();
25
document.write(arr);
26
27
</script>
28
29
</body>
30
</html>
31