Skip to main content
0:01est. 2 min

Chapter 27- Existence and Booleans

Notes

Check
Boolean(undefined); // false
Boolean(null); //false
Boolean(""); //false
Boolean(0); //false
All of these things imply the lack of existence they convert to false.
Example 1
var a ;
if (a) {
console.log(‘Something is there');
}
In above example a will be converted to boolean. We can use coercion to check if variable has some value.