# Using Javascript booleans

## Using Javascript booleans.

• The boolean datatype has only two possible values which is true or false.
• The boolean value is for the most the result of comparisons you make in your JavaScript programs.
• Any program code is meant to do some actions based on conditions.
• These conditions is normally based on an evaluation of values using relational operators which in Javascript are:
==
(equality)
``````'50'==50 // true
30 ==50 // false``````
Returns true when both operands are equal. The operands are converted to the same type before being compared.
!=
(non-equality)
``````'50'!=50 // false
30 !=50 // true``````
Returns true when both operands are not equal. The operands are converted to the same type before being compared.
===
(equality)
``````'50'===50 // false
50 ===50 // true``````
Returns true if both operands are equal and of the same type.
!==
(non-equality)
``````'50'!==50 // true
50 !==50 // false``````
Returns true if both operands are not equal and of the same type.
>
(greater than)
``````'50'>40 // true
50 >50 // false``````
Returns true if the left operand is greater than the right one.
>=
(greater than or equal)
``````'50'>=50 // true
30 >=50 // false``````
Returns true if the left operand is greater than or equal to the right one.
<
(less than)
``````'50'<40 // false
50 <50 // false``````
Returns true if the left operand is greater than the right one.
<=
(less than or equal)
``````'50'<=50 // false
50 <=50 // true``````
Returns true if the left operand is greater than or equal to the right one.
• In such evaluation we can use some Logical Operators as well:
Name Operator Sample Description
AND && expession1 && expression2 Both expressions must return true if the outcome shall be true
OR || expession1 || expression2 One of the expressions must return true if the outcome shall be true
NOT ! !expression If the expression return false the outcome will be true