| Value | Converted To String | Converted To Number | Converted To Boolean |
|---|---|---|---|
| undefinded | "undefined" | NaN | false |
| null | "null" | 0 | false |
| true | "true" | 1 | |
| false | "false" | 0 | |
| NaN | "NaN" | false | |
| "" empty string | 0 | false | |
| " " | 0 | true | |
| "2.4" (numeric) | 2.4 | true | |
| "test" (non numeric | NaN | true | |
| "0" | 0 | true | |
| "1" | 1 | true | |
| -0 | "0" | false | |
| 0 | "0" | false | |
| 1 | "1" | true | |
| Infinity | "Infinity" | true | |
| -Infinity | "-Infinity" | true | |
| [] | "" | 0 | true |
| [3] | "3" | 3 | true |
| ['a'] | "a" | NaN | true |
| ['a','b'] | "a,b" | NaN | true |
| { } | "[object Object]" | NaN | true |
| function(){} | "function(){}" | NaN | true |
Bold values highlight conversion that programmers may find surprising
To convert explicitly values you can use String() Number() Boolean()