formations/javascript/base/structures-2.md

26 lines
662 B
Markdown
Raw Permalink Normal View History

2015-03-25 17:27:03 +01:00
# .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
```