Hello and welcome.
In this video are be introducing you to the javascript comparison operators javascript comparison operators
are used to compare values and will return a boolean result boolean basically remains true or false.
So when you use javascript comparison operators it will always return either a true value or a false
value.
So this is basic table illustrating some comparison operators.
So I'll start from the top which the first is known as the equal operator and is represented with the
double equal symbol.
So what that does.
It checks if values are equal.
OK so if you want to compare two values a core you use the equal to operator if you want to check if
values are equal both in value and data type.
You use this strictly equals 2 which is represented with a triple equal sign is single.
Equal is used to assign a value so we must be careful between the distinction between single equals
or double.
If you want to check if something is equal to something you use a double equal so if you want to assign
if I do like you do in variables you use just a single equal to one.
Compare that the values are strictly equal in both data type and value.
You use the triple equal symbol if you want to check if values are not equal.
You use the exclamation mark that equals to sign that check.
If the values are not equal.
If you want to check if the values are strict you're not equal in value and data type.
You use the exclamation and double a core symbol.
So if you want to check if a value is greater than another value you use the greater than sign.
For example you want to check if five is greater than two.
If he wants to check if it values let's use the less than symbol with checks.
If a number is less and another number of value you can also use the greater than or equal to which
is represented by the greater than sign.
And that equals to sign.
What that does.
It checks if the values is greater than or equal to the less than or equal to is represented by the
less than symbol and the equals to sign these checks.
If the value is less than or equal to so I'm going to jump into the console now and give you some basic
examples of these comparison operators.
So when you're using comparison operators they will always return either a true or false result.
So for example if I want to check if four is equals to five that will return false.
It calls for is not equal to five.
If I want to check if a value is strictly equals in type and also in value.
So what I do first I create a variable called a variable called X.
I've gave this a value of 7 create a variable called Y and I'll give this a value of 7.
But the 7 will be a string value so which means the data type is different from variable x.
So now I can do a comparison.
I can say X is equals to Y.
This will return to true because both of them have a value of 7.
Now if I use the triple A of course 2 it will return to force because the data type is different but
the value is the same.
So if I do X Triple A of course to y that will give me a result of force because they are not equal
in data type the terrible way has a data type of string.
You can tell because of the quotes that is and close around the value and variable x is numerical.
Which has a value of 7 so they are the same in value but not the same in data type.
So if you want to check two values are the same.
For example if I say 8 is not equal to 7 that will return true because 8 is bigger than 7 so it is not
equal to 7.
So if on a check if in number is greater than another number on the check if 9 is greater than say 8
that will evaluate to be true because 9 is greater than 8.
If we say 8 we call 8 is less than say seven that again we evaluate to be true because aid is greater
than 7.
So here am using the less than sign comparing if aid is less than 7 that has returned force because
aid is greater than 7.
If I was to say 7 is less than 8 that will evaluate to be true because 7 is less than 8.
So let me create a couple of variables a great variable a.
I give you the value of 17 and I use the comparison.
So if I see a is greater than or equal to 17 that will evaluate to be true because a variable a 17.
So I'm saying a is greater than not equal to 17 so that evaluates to be true.
If I create another variable say I quit a variable B and assign it a value of 10.
And I want to check comparison so if I say is variable B less than or a course to 9 that will evaluate
to be false because B is 10.
So these are basic examples of comparison operators.
Once you understand the basic concepts then it'll be easy for you to use the comparison operators are
set for this video.
Thank you for watching.
Bye for now.