Skip to content

Commit 915243d

Browse files
committed
finished 40
1 parent 968e9ac commit 915243d

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

topics/about_arrays.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@ module("About Arrays (topics/about_arrays.js)");
22

33
test("array literal syntax and indexing", function() {
44
var favouriteThings = ["cellar door", 42, true]; // note that array elements do not have to be of the same type
5-
equal(__, favouriteThings[0], 'what is in the first position of the array?');
6-
equal(__, favouriteThings[1], 'what is in the second position of the array?');
7-
equal(__, favouriteThings[2], 'what is in the third position of the array?');
5+
equal("cellar door", favouriteThings[0], 'what is in the first position of the array?');
6+
equal(42, favouriteThings[1], 'what is in the second position of the array?');
7+
equal(true, favouriteThings[2], 'what is in the third position of the array?');
88
});
99

1010
test("array type", function() {
11-
equal(__, typeof([]), 'what is the type of an array?');
11+
equal(object, typeof([]), 'what is the type of an array?');
1212
});
1313

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

1919
test("splice", function() {
2020
var daysOfWeek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
21-
var workingWeek = daysOfWeek.splice(__, __);
22-
ok(workingWeek.equalTo([__]), 'what is the value of workingWeek?');
23-
ok(daysOfWeek.equalTo([__]), 'what is the value of daysOfWeek?');
21+
var workingWeek = daysOfWeek.splice(5, 2);
22+
ok(workingWeek.equalTo([0, 5]), 'what is the value of workingWeek?');
23+
ok(daysOfWeek.equalTo([5]), 'what is the value of daysOfWeek?');
2424
});
2525

2626
test("stack methods", function() {
2727
var stack = [];
2828
stack.push("first");
2929
stack.push("second");
3030

31-
equal(__, stack.pop(), 'what will be the first value popped off the stack?');
32-
equal(__, stack.pop(), 'what will be the second value popped off the stack?');
31+
equal("second", stack.pop(), 'what will be the first value popped off the stack?');
32+
equal("first", stack.pop(), 'what will be the second value popped off the stack?');
3333
});
3434

3535
test("queue methods", function() {
@@ -38,6 +38,6 @@ test("queue methods", function() {
3838
queue.push("second");
3939
queue.unshift("third");
4040

41-
equal(__, queue.shift(), 'what will be shifted out first?');
42-
equal(__, queue.shift(), 'what will be shifted out second?');
41+
equal("third", queue.shift(), 'what will be shifted out first?');
42+
equal("first", queue.shift(), 'what will be shifted out second?');
4343
});

topics/about_control_structures.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ test("if", function() {
55
if (2 > 0) {
66
isPositive = true;
77
}
8-
equal(__, isPositive, 'what is the value of isPositive?');
8+
equal(true, isPositive, 'what is the value of isPositive?');
99
});
1010

1111
test("for", function() {
1212
var counter = 10;
1313
for (var i = 1; i <= 3; i++) {
1414
counter = counter + i;
1515
}
16-
equal(__, counter, 'what is the value of counter?');
16+
equal(16, counter, 'what is the value of counter?');
1717
});
1818

1919
test("for in", function() {
@@ -27,7 +27,7 @@ test("for in", function() {
2727
for (var property_name in person) {
2828
result = result + property_name;
2929
}
30-
equal(__, result, 'what is the value of result?');
30+
equal(__), result, 'what is the value of result?');
3131
});
3232

3333
test("ternary operator", function() {

topics/about_equality.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ test("equality with type coercion", function() {
1919

2020
test("string literals", function() {
2121
equal("frankenstein", "frankenstein", "quote types are interchangable, but must match.");
22-
equal("frankensein", 'frankenstein', "quote types can use both single and double quotes.");
22+
equal("frankenstein", 'frankenstein', "quote types can use both single and double quotes.");
2323
});

topics/about_numbers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module("About Numbers (topics/about_numbers.js)");
44
test("types", function() {
55
var typeOfIntegers = typeof(6);
66
var typeOfFloats = typeof(3.14159);
7-
equal(__, typeOfIntegers === typeOfFloats, 'are ints and floats the same type?');
7+
equal(false, typeOfIntegers === typeOfFloats, 'are ints and floats the same type?');
88
equal(__, typeOfIntegers, 'what is the javascript numeric type?');
99
equal(__, 1.0, 'what is a integer number equivalent to 1.0?');
1010
});

topics/about_objects.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module("About Objects (topics/about_objects.js)");
33

44
test("object type", function() {
55
var empty_object = {};
6-
equal(__, typeof(empty_object), 'what is the type of an object?');
6+
equal(literal, typeof(empty_object), 'what is the type of an object?');
77
});
88

99
test("object literal notation", function() {
1010
var person = {
11-
__:__,
12-
__:__
11+
name:"Amory Blaine",
12+
age:"102"
1313
};
1414
equal("Amory Blaine", person.name, "what is the person's name?");
1515
equal(102, person.age, "what is the person's age?");
@@ -21,7 +21,7 @@ test("dynamically adding properties", function() {
2121
person.__ = 102;
2222
equal("Amory Blaine", person.name, "what is the person's name?");
2323
equal(102, person.age, "what is the person's age?");
24-
});
24+
});
2525

2626
test("adding properties from strings", function() {
2727
var person = {};

topics/about_strings.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ module("About Strings (topics/about_strings.js)");
44
test("delimiters", function() {
55
var singleQuotedString = 'apple';
66
var doubleQuotedString = "apple";
7-
equal(__, singleQuotedString === doubleQuotedString, 'are the two strings equal?');
7+
equal(true, singleQuotedString === doubleQuotedString, 'are the two strings equal?');
88
});
99

1010
test("concatenation", function() {
1111
var fruit = "apple";
1212
var dish = "pie";
13-
equal(__, fruit + " " + dish, 'what is the value of fruit + " " + dish?');
13+
equal("apple pie", fruit + " " + dish, 'what is the value of fruit + " " + dish?');
1414
});
1515

1616
test("character Type", function() {
1717
var characterType = typeof("Amory".charAt(1)); // typeof will be explained in about reflection
18-
equal(__, characterType, 'Javascript has no character type');
18+
equal("m", var characterType = typeof("Amory".charAt(1));, 'Javascript has no character type');
1919
});
2020

2121
test("escape character", function() {
2222
var stringWithAnEscapedCharacter = "\u0041pple";
23-
equal(__, stringWithAnEscapedCharacter, 'what is the value of stringWithAnEscapedCharacter?');
23+
equal("Apple", stringWithAnEscapedCharacter, 'what is the value of stringWithAnEscapedCharacter?');
2424
});
2525

2626
test("string.length", function() {
2727
var fruit = "apple";
28-
equal(__, fruit.length, 'what is the value of fruit.length?');
28+
equal(5, fruit.length, 'what is the value of fruit.length?');
2929
});
3030

3131
test("slice", function() {
3232
var fruit = "apple pie";
33-
equal(__, fruit.slice(0,5), 'what is the value of fruit.slice(0,5)?');
33+
equal("apple", fruit.slice(0,5), 'what is the value of fruit.slice(0,5)?');
3434
});

topics/about_truthyness.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ module("About Truthyness (topics/about_truthyness.js)");
33

44
test("truthyness of positive numbers", function() {
55
var oneIsTruthy = 1 ? true : false;
6-
equal(__, oneIsTruthy, 'is one truthy?');
6+
equal(true, oneIsTruthy, 'is one truthy?');
77
});
88

99
test("truthyness of negative numbers", function() {
1010
var negativeOneIsTruthy = -1 ? true : false;
11-
equal(__, negativeOneIsTruthy, 'is -1 truthy?');
11+
equal(true, negativeOneIsTruthy, 'is -1 truthy?');
1212
});
1313

1414
test("truthyness of zero", function() {
1515
var zeroIsTruthy = 0 ? true : false;
16-
equal(__, zeroIsTruthy, 'is 0 truthy?');
16+
equal(false, zeroIsTruthy, 'is 0 truthy?');
1717
});
1818

1919
test("truthyness of null", function() {
2020
var nullIsTruthy = null ? true : false;
21-
equal(__, nullIsTruthy, 'is null truthy?');
21+
equal(false, nullIsTruthy, 'is null truthy?');
2222
});

0 commit comments

Comments
 (0)