Answers for "5.1.2. Boolean Conversion¶"

0

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
Posted by: Guest on June-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language