Welcome back, ladies and gentlemen.
Today, we're going to talk about JavaScript comparison operators.
We already started doing this at the end of the last lecture, but we're going to continue today.
Now, first things first.
Did you finish your exercises?
So lecture one exercise.
So if you haven't, just find that file in the final folder in do doodle, do those exercise is going
to help you.
And if you don't know how to do them, then just open these solution solutions, file for the same lecture
and yeah, you will have the solutions.
OK, now before I start, we the operators and by the way, these are the ones that we are going to
cover today.
We did some of them, these four.
But yeah, we're going to talk about a little bit more in these we will do in future because I kind
of show you we haven't done very well yet.
So let's open here now before doing the comparison operators, remember, I've just said that we have
external file and we linking that file into the index, that HTML we'd calling this creep attack.
Now we need to specify the type and the source.
These SIRC stands for source.
We just defined the source and that is in the same directory as the index HTML file.
OK, that's pretty much clear, but this is called external Cyesis file.
So the other way is we can run.
A JavaScript code here in the console, right in the browser now the third way, it's very simple,
we can actually run JavaScript here.
So what I all need to do is open the script and close that script and put type here even without typing
will work.
Text SportWagen JavaScript.
Now, here we are going to run, I mean, not run, we are going to type our JavaScript code, for example,
was the most simple one.
So hello from here.
Now save it.
Let's open up.
And why you don't see the output?
Well, because it's here.
It's in first line and why it's in the first line, because these JavaScript will run before the external
file.
Right, if we put it back.
This, then it will be on the last line, nice, so I'm not going to use in line and I'm not going to
use the browser much, but definitely I will use the external files.
And today we're going to create a new file called Lecture two that J is.
Now, what I haven't told you is that J is now these dodgiest genius stands for JavaScript and it's
called extension.
And this extension will tell.
Yeah, we are going to write a JavaScript code like this HTML saying, OK, this will be contained on
HTML markup.
Nice.
So we create a cover.
A lot of things that we haven't done in the previous lecture.
Now if you don't see these icons that I have here, you can do you can search this code.
There are different packages, icons like that.
And this is the one that I have.
So you can install it.
I already have it.
And yeah, it will change your icons like mine, but you can find different icons like this.
Look, this is even nicer, you know what, I'm going to install it.
Pendle see here is now set fire like a. good.
And didn't change anything, probably needs to restart, it doesn't matter.
OK, now you know how to install.
I come back, right.
But you're also going to work because if you haven't done before, yeah, it will pretty much work.
OK, so we create the second lecture to not just file, but now here we need to common this one.
So so select the entire line, command forward slash iMac or control forward slash in Windows and save
it.
But now I don't have links to any of the files, but I do want to link the my second file.
Right, because now if I go here it will be empty.
We don't have anybody here.
And let's write console that log.
In, say, Java script comparison.
All parade tourists.
If I misspelled something, don't please don't judge me.
Now, if you click here, it will just make the full window right now.
This No one means that I haven't save it, cuz now you know all those things about the Eskild, some
teaching and things that I shouldn't.
I'm sorry.
And now let's start with the comparison operator.
So first things first.
I'm just going to write console that log five is greater than five.
OK, Rod, console the log another one.
And let's put a breathing space here.
Let's copy this one here.
Let's create a one comment.
So the comments are two double forward slash, but we can make a multiple line comments and that's forward
slash.
Star, and we need to close this one star forward slash, so anything between these two, it's going
to be considered as a common multi line comment.
Now you know how to do a multiline comments as well.
Nice.
So save this one.
Go back to five smaller than six.
Nice.
So what we do have I'm going to read it more scenarios and we're going to discuss about this.
So greater or equal to.
And you know what?
Just to make sure that you have a breathing space between to be just more readable.
Right.
OK, it's not going to throw you in there, don't worry about it, so this will be greater than than
we need to do five less than let's make it five less than fire.
And that's it.
Let's stop here.
OK, save it.
Now we have false.
True, true, true.
Oh, well, five is not greater than five and it's always going to return a boolean value called false.
Right now the second one six is a greater than five.
Yes, that's true.
And the third one, what we are doing, we are seeing if is five greater or equal to five.
So because it's not greater but is equal to and that's why it give us true.
Now the other one is five is smaller, equal to five.
And it's not smaller, but it's equal to.
And that's why again, it's giving us true.
Now what is about this operator?
Have you seen something like this?
Well, if it's your first time JavaScript that you haven't, probably five is equal, equal to five.
Now, this is something interesting.
So what this will do, it will throw true here.
Right.
Let's make something here.
Let's make here for just to make sure that we have false yeah, do you know where we are?
So we have false then that this one is true.
So this equal equal to means equal value in equal type.
So checking the value five is the same as this.
And he's also checking the type and the type is a number and also both are true.
So that is equal.
But what about cancel that log.
Five, equal to five.
Do you think what will happen here now, we're not going to talk about this, it's called Inverleith
left hand side assignment.
Now we haven't done variables, but equals in JavaScript means assign.
For example, if I have here variable call X, then I will say, OK, to this variable X give assign
a value of five.
Right.
That's why I'm not going to cover.
And I told you that we are going to do them in future.
Actually I don't have.
Yeah, probably I'm going to do the future so.
Yep.
That will be.
So it's not working like that.
That's why I don't talk now, the next one very interesting is that log six.
Is not equal to five, make sure you understand what I'm trying to do here, not equal do five anything
in JavaScript, you see exclamation mark, it will make that one to to be opposite of that one.
Right.
So this one means equal, but this means not in JavaScript.
So it will make it the opposite.
Now, this will mean not equal.
And not not equal type.
And not equal value.
OK, so it may not equal time and not equal value.
Good.
So what, you think this will happen?
So obviously here we have the same type.
The type is a correct in six is not equal to five.
Well, that should be true because six is not equal to five.
And we have the same numbers.
Same type of numbers.
Right.
OK, let's do one more.
I mean, with the same operator six not equal to six, would you think this will happen?
So we saying that this is a from a type number and it's not equal to.
Six, well, that's not true.
Six is equal to six, right?
So here we can compare it to something else.
And it will say true, why will say true?
Well, six is not equal to something, something is a string.
And first things first.
This will check if the time is a number.
So six is a number, string is not string.
This one is string.
So it's not a number.
So it's not equal time.
So the first parameter is not satisfied.
And again, six is not even equal to something.
Right.
The value is different.
OK, that is pretty much it.
Well, I can leave that one there.
Don't worry about it.
So you know about the comparison operators and we will talk more about them, the rest of them.
Oops.
In future.
So stay safe and I will see you in the next one.