Skip to content

Commit 2e30e53

Browse files
committed
Array tests passing
1 parent e3406cb commit 2e30e53

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

topics/about_arrays.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ $(document).ready(function(){
55

66
test("array literal syntax and indexing", function() {
77
var favouriteThings = ["cellar door", 42, true]; // note that array elements do not have to be of the same type
8-
equals(favouriteThings[0], __, 'what is in the first position of the array?');
9-
equals(favouriteThings[1], __, 'what is in the second position of the array?');
10-
equals(favouriteThings[2], __, 'what is in the third position of the array?');
8+
equals(favouriteThings[0], "cellar door", 'what is in the first position of the array?');
9+
equals(favouriteThings[1], 42, 'what is in the second position of the array?');
10+
equals(favouriteThings[2], true, 'what is in the third position of the array?');
1111
});
1212

1313
test("array type", function() {
14-
equals(typeof([]), __, 'what is the type of an array?');
14+
equals(typeof([]), "object", 'what is the type of an array?');
1515
});
1616

1717
test("length", function() {
1818
var collection = ['a','b','c'];
19-
equals(collection.length, __, 'what is the length of the collection array?');
19+
equals(collection.length, 3, 'what is the length of the collection array?');
2020
});
2121

2222
test("delete", function() {
2323
var daysOfWeek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
24-
var workingWeek = daysOfWeek.splice(__, __);
25-
ok(workingWeek.equalTo([__]), 'what is the value of workingWeek?');
26-
ok(daysOfWeek.equalTo([__]), 'what is the value of daysOfWeek?');
24+
var workingWeek = daysOfWeek.splice(0, 5);
25+
ok(workingWeek.equalTo(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']), 'what is the value of workingWeek?');
26+
ok(daysOfWeek.equalTo(['Saturday', 'Sunday']), 'what is the value of daysOfWeek?');
2727
});
2828

2929
test("stack methods", function() {
3030
var stack = [];
3131
stack.push("first");
3232
stack.push("second");
3333

34-
equals(stack.pop(), __, 'what will be the first value poped off the stack?');
35-
equals(stack.pop(), __, 'what will be the second value poped off the stack?');
34+
equals(stack.pop(), 'second', 'what will be the first value poped off the stack?');
35+
equals(stack.pop(), 'first', 'what will be the second value poped off the stack?');
3636
});
3737

3838
});

0 commit comments

Comments
 (0)