2020-01-10
Variable | typeof x !== 'undefined' |
x != null |
x!== null |
x ? true : false |
---|---|---|---|---|
let varOne = 1; |
true |
true |
true |
true |
let varEmpty = 0; (or empty string / structure) |
true |
true |
true |
false |
let varNull = null; |
true |
false |
false |
false |
let varUnDefined; |
false |
false |
true |
false |
Variable is undeclared | false |
exception | exception | exception |
Returning from function without value returns undefined.
const object can be changed, but cannot be reassigned to point to another object.