Skip to content

Commit 235f4d5

Browse files
committed
implemented control structures
1 parent ccb7213 commit 235f4d5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

topics/about_control_structures.js

Lines changed: 8 additions & 8 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() {
@@ -27,15 +27,15 @@ test("for in", function() {
2727
for (property_name in person) {
2828
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() {
3434
var fruit = true ? "apple" : "orange";
35-
equals(fruit, __, 'what is the value of fruit?');
35+
equals(fruit, "apple", 'what is the value of fruit?');
3636

3737
fruit = false ? "apple" : "orange";
38-
equals(fruit, __, 'now what is the value of fruit?');
38+
equals(fruit, "orange", 'now what is the value of fruit?');
3939
});
4040

4141
test("switch", function() {
@@ -48,7 +48,7 @@ test("switch", function() {
4848
result = 2;
4949
break;
5050
}
51-
equals(result, __, 'what is the value of result?');
51+
equals(result, 2, 'what is the value of result?');
5252
});
5353

5454
test("switch default case", function() {
@@ -64,10 +64,10 @@ test("switch default case", function() {
6464
result = "Merry";
6565
break;
6666
}
67-
equals(result, __, 'what is the value of result?');
67+
equals(result, "Merry", 'what is the value of result?');
6868
});
6969

7070
test("null coalescing", function() {
7171
var result = null || "a value";
72-
equals(result, __, 'what is the value of result?');
72+
equals(result, "a value", 'what is the value of result?');
7373
});

0 commit comments

Comments
 (0)