JavaScript Type Conversion Table
The below table shows the conversion of various values to String, Number, and Boolean in JavaScript.
Value | String Conversion | Number Conversion | Boolean Conversion |
---|---|---|---|
1 | "1" | 1 | true |
0 | "0" | 0 | false |
"1" | "1" | 1 | true |
"0" | "0" |
0 | true |
"ten" | "ten" |
NaN |
true |
true |
"true" | 1 | true |
false |
"false" | 0 | false |
null |
"null" | 0 | false |
undefined |
"undefined" | NaN |
false |
'' | "" | 0 | false |
' ' | " " | 0 | true |
Comments
Post a Comment