Skip to content

Commit 8d4e80f

Browse files
committed
shift and unshift, array methods
1 parent 4ffb615 commit 8d4e80f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

topics/about_arrays.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
module("About Arrays (topics/about_arrays.js)");
32

43
test("array literal syntax and indexing", function() {
@@ -32,3 +31,13 @@ test("stack methods", function() {
3231
equals(stack.pop(), __, 'what will be the first value popped off the stack?');
3332
equals(stack.pop(), __, 'what will be the second value popped off the stack?');
3433
});
34+
35+
test("queue methods", function() {
36+
var queue = [];
37+
queue.push("first");
38+
queue.push("second");
39+
queue.unshift("third");
40+
41+
equals(queue.shift(), "third", 'what will be shifted out first?');
42+
equals(queue.shift(), "first", 'what will be shifted out second?');
43+
});

0 commit comments

Comments
 (0)