Skip to content

Commit 4861b99

Browse files
committed
Merge pull request GitbookIO#19 from octatone/master
Update to JS Comparators lesson.
2 parents ce0a1f4 + fea7c93 commit 4861b99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

conditional/comparators.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (country === "France") {
88
}
99
```
1010

11-
The conditional part is the country followed by the three equal signs (`===`). Three equal signs mean that the condition tests if the variable country has the value you test against but also the correct variable (data)type. You can test conditions with double equal signs, too, but that would mean that `if(x == 5)` would be true for x being 5 and x being “5”. Depending on what your program is doing, this could make quite a difference.
11+
The conditional part is the variable `country` followed by the three equal signs (`===`). Three equal signs tests if the variable `country` has both the correct value (`France`) and also the correct type (`String`). You can test conditions with double equal signs, too, however a conditional such as `if (x == 5)` would then return true for both `var x = 5;` and `var x = "5";`. Depending on what your program is doing, this could make quite a difference. It is highly recommended as a best practice that you always compare equality with three equal signs (`===` and `!==`) instead of two (`==` and `!=`).
1212

1313
Other conditional test:
1414

@@ -21,7 +21,7 @@ Other conditional test:
2121

2222
---
2323

24-
Add a condition to change the value of `a` to 10 if `x` is bigger than 5.
24+
Add a condition to change the value of `a` to the number 10 if `x` is bigger than 5.
2525

2626
```js
2727
var x = 6;
@@ -40,7 +40,7 @@ if (x > 5) {
4040
```
4141

4242
```js
43-
assert(a == 10);
43+
assert(a === 10);
4444
```
4545

46-
---
46+
---

0 commit comments

Comments
 (0)