Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

5.1.2. Boolean Conversion¶

/*As with the number and string data types, the boolean type also has 
a conversion function, Boolean. It works similarly to the Number and 
String functions, attempting to convert a non-boolean value to a 
boolean.*/

console.log(Boolean("true"));  //true
console.log(Boolean("TRUE"));  //true
console.log(Boolean(0));  //false
console.log(Boolean(1));  //true
console.log(Boolean(''));  //false
console.log(Boolean('LaunchCode'));  //true 
Source by education.launchcode.org #
 
PREVIOUS NEXT
Tagged: #Boolean
ADD COMMENT
Topic
Name
6+9 =