Skip to content

Commit 1dce565

Browse files
author
FOUNDATIONSOFT\AHunter
committed
more
1 parent 9f3cb31 commit 1dce565

File tree

5 files changed

+43
-43
lines changed

5 files changed

+43
-43
lines changed

topics/about_arrays.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ 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(__, __);
21+
var workingWeek = daysOfWeek.splice(0, 5);
2222
var weekend = daysOfWeek;
2323

2424
deepEqual(workingWeek, ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'], 'what is the value of workingWeek?');
@@ -30,8 +30,8 @@ test("stack methods", function() {
3030
stack.push("first");
3131
stack.push("second");
3232

33-
equal(__, stack.pop(), 'what will be the first value popped off the stack?');
34-
equal(__, stack.pop(), 'what will be the second value popped off the stack?');
33+
equal("second", stack.pop(), 'what will be the first value popped off the stack?');
34+
equal("first", stack.pop(), 'what will be the second value popped off the stack?');
3535
});
3636

3737
test("queue methods", function() {
@@ -40,6 +40,6 @@ test("queue methods", function() {
4040
queue.push("second");
4141
queue.unshift("third");
4242

43-
equal(__, queue.shift(), 'what will be shifted out first?');
44-
equal(__, queue.shift(), 'what will be shifted out second?');
43+
equal("third", queue.shift(), 'what will be shifted out first?');
44+
equal("first", queue.shift(), 'what will be shifted out second?');
4545
});

topics/about_numbers.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ 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?');
8-
equal(__, typeOfIntegers, 'what is the javascript numeric type?');
9-
equal(__, 1.0, 'what is a integer number equivalent to 1.0?');
7+
equal(true, typeOfIntegers === typeOfFloats, 'are ints and floats the same type?');
8+
equal("number", typeOfIntegers, 'what is the javascript numeric type?');
9+
equal(1, 1.0, 'what is a integer number equivalent to 1.0?');
1010
});
1111

1212
test("NaN", function() {
1313
var resultOfFailedOperations = 7/'apple';
14-
equal(__, isNaN(resultOfFailedOperations), 'what will satisfy the equals assertion?');
15-
equal(__, resultOfFailedOperations == NaN, 'is NaN == NaN?');
14+
equal(true, isNaN(resultOfFailedOperations), 'what will satisfy the equals assertion?');
15+
equal(false, resultOfFailedOperations == NaN, 'is NaN == NaN?');
1616
});

topics/about_objects.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@ 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("object", 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?");
1616
});
1717

1818
test("dynamically adding properties", function() {
1919
var person = {};
20-
person.__ = "Amory Blaine";
21-
person.__ = 102;
20+
person.name = "Amory Blaine";
21+
person.age = 102;
2222
equal("Amory Blaine", person.name, "what is the person's name?");
2323
equal(102, person.age, "what is the person's age?");
2424
});
2525

2626
test("adding properties from strings", function() {
2727
var person = {};
28-
person["__"] = "Amory Blaine";
29-
person["__"] = 102;
28+
person["name"] = "Amory Blaine";
29+
person["age"] = 102;
3030
equal("Amory Blaine", person.name, "what is the person's name?");
3131
equal(102, person.age, "what is the person's age?");
3232
});
@@ -36,7 +36,7 @@ test("adding functions", function() {
3636
name: "Amory Blaine",
3737
age: 102,
3838
toString: function() {
39-
return __; // HINT: use the 'this' keyword to refer to the person object.
39+
return `I ${this.name} am ${this.age} years old.`; // HINT: use the 'this' keyword to refer to the person object.
4040
}
4141
};
4242
equal("I Amory Blaine am 102 years old.", person.toString(), "what should the toString function be?");

topics/about_reflection.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ function B() {
1111
B.prototype = new A();
1212

1313
test("typeof", function() {
14-
equal(__, typeof({}), 'what is the type of an empty object?');
15-
equal(__, typeof('apple'), 'what is the type of a string?');
16-
equal(__, typeof(-5), 'what is the type of -5?');
17-
equal(__, typeof(false), 'what is the type of false?');
14+
equal("object", typeof({}), 'what is the type of an empty object?');
15+
equal("string", typeof('apple'), 'what is the type of a string?');
16+
equal("number", typeof(-5), 'what is the type of -5?');
17+
equal("boolean", typeof(false), 'what is the type of false?');
1818
});
1919

2020
test("property enumeration", function() {
@@ -25,8 +25,8 @@ test("property enumeration", function() {
2525
keys.push(propertyName);
2626
values.push(person[propertyName]);
2727
}
28-
ok(keys.equalTo(['__','__','__']), 'what are the property names of the object?');
29-
ok(values.equalTo(['__',__,__]), 'what are the property values of the object?');
28+
ok(keys.equalTo(['name','age','unemployed']), 'what are the property names of the object?');
29+
ok(values.equalTo(['Amory Blaine',102,true]), 'what are the property values of the object?');
3030
});
3131

3232
test("hasOwnProperty", function() {
@@ -37,8 +37,8 @@ test("hasOwnProperty", function() {
3737
for (propertyName in b) {
3838
keys.push(propertyName);
3939
}
40-
equal(__, keys.length, 'how many elements are in the keys array?');
41-
deepEqual([__, __], keys, 'what are the properties of the array?');
40+
equal(2, keys.length, 'how many elements are in the keys array?');
41+
deepEqual(["bprop", "aprop"], keys, 'what are the properties of the array?');
4242

4343
// hasOwnProperty returns true if the parameter is a property directly on the object,
4444
// but not if it is a property accessible via the prototype chain.
@@ -48,21 +48,21 @@ test("hasOwnProperty", function() {
4848
ownKeys.push(propertyName);
4949
}
5050
}
51-
equal(__, ownKeys.length, 'how many elements are in the ownKeys array?');
52-
deepEqual([__], ownKeys, 'what are the own properties of the array?');
51+
equal(1, ownKeys.length, 'how many elements are in the ownKeys array?');
52+
deepEqual(["bprop"], ownKeys, 'what are the own properties of the array?');
5353
});
5454

5555
test("constructor property", function () {
5656
var a = new A();
5757
var b = new B();
58-
equal(__, typeof(a.constructor), "what is the type of a's constructor?");
59-
equal(__, a.constructor.name, "what is the name of a's constructor?");
60-
equal(__, b.constructor.name, "what is the name of b's constructor?");
58+
equal("function", typeof(a.constructor), "what is the type of a's constructor?");
59+
equal("A", a.constructor.name, "what is the name of a's constructor?");
60+
equal("A", b.constructor.name, "what is the name of b's constructor?");
6161
});
6262

6363
test("eval", function() {
6464
// eval executes a string
6565
var result = "";
6666
eval("result = 'apple' + ' ' + 'pie'");
67-
equal(__, result, 'what is the value of result?');
67+
equal("apple pie", result, 'what is the value of result?');
6868
});

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("string", characterType, '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
});

0 commit comments

Comments
 (0)