You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Boolean consists of only two values - True and False.
Null and undefined
leta;letb=null;console.log(a,b);
OUTPUT
undefined null
Null - It represents the intentional absence of a value.
Undefined - It shows that the value is yet to be assigned.
Comparison Operators
letage=18;console.log(age==18);// Is equal toconsole.log(age!=18);// Is not equal toconsole.log(age>18);// Is greater thanconsole.log(age<18);// Is less than
OUTPUT
True
False
False
False
Loose comparison
letage=18;console.log(age==18);console.log(age=="18");// Implicit type conversion takes place
OUTPUT
True
True
Before comparing, Type conversion takes place.
Strict comparison
letage=18;console.log(age===18);console.log(age==="18");// no type conversion takes place.
OUTPUT
True
False
No type conversion takes place before comparison.
Type Conversion
Implicit conversion
letage=18;console.log(age==18);console.log(age=="18");// Implicit type conversion takes place
OUTPUT
True
True
In this example, type conversion is done by browser, thus it is an Implicit conversion.