28 lines
683 B
Markdown
28 lines
683 B
Markdown
|
# .cadoles-slide-title[Structures de contrôle (2/3)]
|
||
|
|
||
|
.cadoles-clearfix[
|
||
|
**Tests, transitivité, égalité stricte et petites subtilités**
|
||
|
]
|
||
|
```js
|
||
|
var test;
|
||
|
|
||
|
test = 1 == '1'; // -> true
|
||
|
test = 1 === '1'; // -> false
|
||
|
|
||
|
test = 0 == false; // -> true
|
||
|
test = 0 === false; // -> false
|
||
|
|
||
|
test = 1 == true; // -> true
|
||
|
test = 1 === true; // -> false
|
||
|
|
||
|
test = '' == false; // -> true
|
||
|
test = '' === false; // -> false
|
||
|
|
||
|
test = [] == false; // -> true
|
||
|
test = [] === false; // -> false
|
||
|
|
||
|
test = undefined == null; // -> true
|
||
|
test = undefined == false; // -> false
|
||
|
test = NaN == NaN; // -> false
|
||
|
```
|