Skip to content

Commit 194ae6b

Browse files
author
Em01
committed
Operators
1 parent 404d28e commit 194ae6b

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

topics/about_operators.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ test("addition", function() {
66
//starting i at 0, add i to result and increment i by 1 until i is equal to 5
77
for (var i = 0; i <= 5; i++) {
88
result = result + i;
9+
console.log(result);
10+
// console.log(i);
11+
912
}
10-
equal(__, result, "What is the value of result?");
13+
equal(15, result, "What is the value of result?");
1114
});
1215

1316
test("assignment addition", function() {
@@ -16,23 +19,23 @@ test("assignment addition", function() {
1619
//the code below is just like saying result = result + i; but is more concise
1720
result += i;
1821
}
19-
equal(__, result, "What is the value of result?");
22+
equal(15, result, "What is the value of result?");
2023
});
2124

2225
test("subtraction", function() {
2326
var result = 5;
2427
for (var i = 0; i <= 2; i++) {
2528
result = result - i;
2629
}
27-
equal(__, result, "What is the value of result?");
30+
equal(2, result, "What is the value of result?");
2831
});
2932

3033
test("assignment subtraction", function() {
3134
var result = 5;
3235
for (var i = 0; i <= 2; i++) {
3336
result -= i;
3437
}
35-
equal(__, result, "What is the value of result?");
38+
equal(2, result, "What is the value of result?");
3639
});
3740

3841
//Assignment operators are available for multiplication and division as well
@@ -43,5 +46,5 @@ test("modulus", function() {
4346
var x = 5;
4447
//again this is exactly the same as result = result % x
4548
result %= x;
46-
equal(__, result, "What is the value of result?");
49+
equal(0, result, "What is the value of result?");
4750
});

0 commit comments

Comments
 (0)