Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

To get "queue" like behavior in a array, use push and shift #208

Closed
wants to merge 1 commit into from

2 participants

@senpost

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. 

@senpost senpost 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. 
5256044
@ajpiano
Collaborator

Fixed in 963b26e, thanks though @senpost

@ajpiano ajpiano closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 10, 2012
  1. @senpost

    Update page/javascript-101/arrays.md

    senpost authored
    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. 
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 page/javascript-101/arrays.md
View
4 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 ]
Something went wrong with that request. Please try again.