comments: True layout: post title: Javascript Boolean Data Type description: Booleans are a type of data that can represent only two possible values: true or false. In this guide, we will explore how the boolean data type works in JavaScript. author: Popcorn permalink: /csse/javascript/fundamentals/booleans/p1 categories: [CSSE JavaScript Fundamentals] —

What is booleans? Booleans are a fundamental data type in programming that represent two possible values: true or false. They are commonly used to make decisions in code, control the flow of programs through conditional statements, and evaluate logical expressions. Booleans are essential for comparisons, determining equality, and managing program logic effectively.

== (Equal to): Checks if two values are equal in value but not necessarily in type (e.g., comparing numbers and strings with similar content like 5 == ‘5’ evaluates to true).

!= (Not equal to): Checks if two values are different in value but not necessarily in type (e.g., 5 != ‘5’ evaluates to false).

=== (Strict equal to): Checks if two values are equal in both value and type (e.g., 5 === ‘5’ evaluates to false because one is a number and the other is a string).

!== (Strict not equal to): Checks if two values are different in either value or type (e.g., 5 !== ‘5’ evaluates to true).

(Greater than): Checks if the left value is larger than the right value (e.g., 10 > 5 evaluates to true).

< (Less than): Checks if the left value is smaller than the right value (e.g., 3 < 7 evaluates to true).

= (Greater than or equal to): Checks if the left value is larger than or equal to the right value (e.g., 18 >= 18 evaluates to true).

<= (Less than or equal to): Checks if the left value is smaller than or equal to the right value (e.g., 5 <= 10 evaluates to true).