Skip to content Skip to sidebar Skip to footer

Javascript Type Conversion Table

I have a question about type conversions. Given the following table from w3schools.com... Why are the strings '0' and '000' converted to boolean true?

Solution 1:

The reason of it is because both "0" and "000" are strings and not numbers.

Any string which is non-empty converted to boolean is going to be true.

Post a Comment for "Javascript Type Conversion Table"