Skip to content

Commit db629ca

Browse files
committed
About control structures
1 parent 9dbd6e7 commit db629ca

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

topics/about_assignment.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
21
module("About Assignment (topics/about_assignment.js)");
32

43
test("local variables", function() {
5-
var temp = __;
4+
var temp = 1;
65
equals(1, temp, "Assign a value to the variable temp");
76
});
87

98
test("global variables", function() {
10-
temp = 1;
11-
equals(temp, window.__, 'global variables are assigned to the window object');
9+
temp = 1;
10+
equals(temp, window.temp, 'global variables are assigned to the window object');
1211
});
12+

topics/about_control_structures.js

Lines changed: 5 additions & 5 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-
equals(isPositive, __, 'what is the value of isPositive?');
8+
equals(isPositive, true, '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-
equals(counter, __, 'what is the value of counter?');
16+
equals(counter, 16, 'what is the value of counter?');
1717
});
1818

1919
test("for in", function() {
@@ -24,10 +24,10 @@ test("for in", function() {
2424
};
2525
var result = "";
2626
// for in enumerates the property names of an object
27-
for (property_name in person) {
28-
result = result + property_name;
27+
for (property_name in person) {
28+
result = result + property_name;
2929
};
30-
equals(result, __, 'what is the value of result?');
30+
equals(result, 'nameage', 'what is the value of result?');
3131
});
3232

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

topics/about_truthyness.js

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

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

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

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

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

0 commit comments

Comments
 (0)