1
00:00:00,580 --> 00:00:07,620
Comparison operators are used to compare the equality or difference between variables or values.

2
00:00:07,630 --> 00:00:11,890
There are several comparison operators that can be used in JavaScript.

3
00:00:11,890 --> 00:00:19,010
This chart provides an overview of each one will go through a few of them to demonstrate how they work

4
00:00:20,210 --> 00:00:21,360
in this test script.

5
00:00:21,380 --> 00:00:29,110
We've created a variable and assigned it a value of six we'll use the get element by idea method to

6
00:00:29,110 --> 00:00:36,190
output a true or false result when using different comparison operators to compare our variable value

7
00:00:37,060 --> 00:00:37,950
with another value.

8
00:00:39,720 --> 00:00:49,190
Let's start with our equal to operator let's test to see if our variable value is equal to 8.

9
00:00:49,220 --> 00:00:50,830
We know that this is not the case.

10
00:00:51,500 --> 00:00:59,270
So our script should output the word false when we tested in our web browser so save this file and just

11
00:00:59,270 --> 00:01:00,340
tested in the browser.

12
00:01:02,230 --> 00:01:06,910
And we can see that it does in fact output the word false.

13
00:01:09,860 --> 00:01:12,020
If we were to change the value to 6

14
00:01:15,430 --> 00:01:25,830
then and refresh our web browser the output is true because our variable value x is in fact equal to

15
00:01:25,830 --> 00:01:26,340

16
00:01:31,940 --> 00:01:47,170
we can use the not equal operator to see if our variable is not equal to 10 for example.

17
00:01:47,210 --> 00:01:51,450
This is the symbol for not equal will update the six to 10

18
00:01:54,480 --> 00:02:03,720
so we know that our variable value 6 is not equal to 10 so when we test this in our web browser it should

19
00:02:03,720 --> 00:02:07,770
display true which it does.

20
00:02:07,930 --> 00:02:09,640
Now if we were to change this to 6

21
00:02:12,300 --> 00:02:21,160
it should display false because our variable value is in fact equal to 6.

22
00:02:21,230 --> 00:02:25,370
You can test out the remaining comparison operators and see what the outcome produces.
