26 lines
662 B
Markdown
26 lines
662 B
Markdown
|
# .cadoles-slide-title[Structures de contrôle (2/3)]
|
||
|
|
||
|
**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
|
||
|
```
|