Permalink
Browse files

Update page/javascript-101/arrays.md

To get queue like behavior in a array, document suggest to use "pop" and shift. But it should be "push" and shift as the example suggests. 
  • Loading branch information...
1 parent cc3dbfe commit 5256044c38ce2d19db90baf93a56b3a71e00843d @senpost committed Dec 10, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 page/javascript-101/arrays.md
@@ -146,10 +146,10 @@ myArray.reverse();
### `.shift`
-Removes the first element of an array. With `.pop` and `.shift`, you can recreate the method of a [queue](http://en.wikipedia.org/wiki/Queue_(data_structure)):
+Removes the first element of an array. With `.push` and `.shift`, you can recreate the method of a [queue](http://en.wikipedia.org/wiki/Queue_(data_structure)):
```
-// queue with shift() and pop()
+// queue with shift() and push()
var myArray = [];
myArray.push( 0 ); // [ 0 ]

0 comments on commit 5256044

Please sign in to comment.