Welcome, everyone.
Today, we going to discuss about primitive JavaScript data types in primitive JavaScript data that
can be separated in five different categories.
So we are going to do that.
So I'm just going to close this one in in our Geass folder.
Let's create an additional file called Variables the G.
So we going to learn about variables.
This lecture is about variables indeed at times.
Very good.
Now, there are five different data that's in.
I'm just going to create multiple comments here.
The first is a string.
Now, that is sequence of characters used for a text.
The second one is no, the no.
It can be no can be like integer decimals or point numbers.
So you will see this.
Don't worry about it.
The third one will be Boolean and boolean means logical, true or false in the number four will be undefined
and you will see what undefined means in the next one will be.
No.
So also mean non-existent.
So undefined is the type of variable that does not have a value yet.
Right.
It's a difference between now and this one.
So I just saved that file.
And let's do let's start working with variables.
So the first thing you need to know is we need to create a variable.
So how are we creating variable?
So first we thought were in the name of the variable, for example, my first name in mine, I'm using
Camil case, so I'm starting a lower in that.
The second word, I'm just using the capital n right.
That is called cavalcades.
If you don't know, just read it.
So the first name, let's call it here.
I just want this one to be E in single quotes.
Now in JavaScript you can do single or double quotes.
Doesn't matter, it will work.
But now most of the time she will see me single quotes.
But if I do use double quotes, don't worry, it will still work.
Now I have done this in so mostly one come come on case notation.
So I have this one here as a string.
So what we can do, we can actually cancel like this one, we can print out this values how we can do
this.
So can the log remember the last time you just put it on screen here, like saying blah, blah, blah,
blah, but we're not going to do that.
So we just going to pass in this variable here.
So that's why we learning variables.
Very good.
Now, if I save this, nothing will happen because here I need to initiate the script because that is
under a different name.
It's called Variables Dodgiest, and I need to remove that rest of the part.
So I do have to script and what is running after the other.
What we have in this one is actually hello world from the external file JS file or we can say for external
scripts, just file in.
This one is from there.
OK, now what I can do I can just make it.
Here comes the lock printing the value from the variable.
Now this is how we can, if we can create a variable and we can pass in value to this variable.
So that is pretty much it.
Now I do have linked this in our index of HTML.
So if I refresh.
So printing the value from the variable.
Very good in the values feature.
So if you don't want to see this actually looks kind of ugly, we're going to just comment this one
here.
And it's not going to work there.
It's not going to be there.
So Peter is the name now.
This is from the type Sprink, right?
Because we are passing a sequence of characters.
Now, let's create another variable here on top and saying, OK, I just want to have old and I will
just put a thirty three because I'm thirty three at this moment now or years or whatever you want to
put there.
Now I just see old in 33.
You see this is not in single quotes or in double goals.
That means it's, it's a number now I can just kinda like oh Ian it should give me these thirty three.
How awesome is this is different.
Color in mind is green.
Your can be blue or a different color.
Right now I have variables.
All I have variables.
First names.
I have a string, I have a number.
Now the second thing that I want to have is I'm going to say OK.
More so check.
No, it's like a check, I'm going to say alien, OK, this is so strange.
So if I do it like this is going to be undefined, but I'm going to say, am I an alien, true or false?
Because Boolean asep to values.
So remember this, the number three is a boolean and we say, OK, the boolean, it can accept two values,
true and false.
So the data type can be only true or false.
So am I alien?
I guess not.
I'm not.
I'm just a normal human being, just like you.
So calls a lot.
Yeah.
We just going to say alien in.
Don't forget this one at the end, so it would give me four if you are an alien just in case and you
put it is true, it will change.
You need to refresh.
It will be true.
They're very good.
Now, I'm just going to return back to what it was.
Now, next one that I'm going to say it's undefined.
So let's say, OK, so you have a first name we have or how old are you?
You're not alien.
And we're going to say bar and we're going to say.
Non-value and I'm just going to not define it, because the right part of the equal operator means defining
a value defining or a sign of that's how you call it in the programming language or everywhere you are
signing a value to a variable.
This is how we assign a string.
This is how we assign a number.
This is how we assign a boolean value.
And so now we are undefined.
So what we think what you think will happen if I print just non-value.
Let's save it.
Let's refresh, ensure it does its thing, not undefined variables.
So this one here, it's telling me from which where it comes from.
It's saying variables.
The G is 20, Semco nine.
Now that 20 is the line number.
Right, 20 line numbers.
I do have this line number and actually can debug it.
Sometimes you can put a breakpoint here, but that doesn't matter.
It's not for this lecture's or W tutorials.
So now that is pretty much what we need to have.
What you need to know about variables in data that I hope you enjoyed this one.
Now you know how to assign a value here and how to assign up to a variable value so that can be streamed
boolean undefined and unknown.
So we've got we've got to use most of these in our practice.
You're going to find this in some code JavaScript code.
So I want you to know that these are basic variables, data types, and they're called primitive.
Right.
So they're calling the primitive.
Primitive variable.
But some of it is going to make it like this primitive variables and data that so if you refresh, it's
going to be able to see it.
Right.
And this is how we can bring it out now.
One more thing that you can bring out in a different way.
So this if you don't want to use the console lock, what you can do, you can learn things.
Alert means there will be a there will be an alert box, for example, first name.
So here you need to pass in the variable or a screen here in order to initiate the alert.
Now, the thing is that when the Lord is initiated, these all will be first initiated.
And the last thing that it will come is the alert.
And look at what's happening.
The alert will create this sort of box when it's telling us what actually we are passing inside.
So alert is a function here.
You can see on top it's still spinning, right?
It is not finished after we click, OK, it will finish because it doesn't know it.
Wait us for an action.
So there are a lot of different alerts and not a lot of different, but there are different alerts.
But this is one way to print out the values or result or anything you want.
Sometimes when the user clicks something, you want to alert them and say, OK, don't do this because
you're going to delete this data permanently.
That's why the alerts are there in probably going to use them in our future lectures.
But this is how you can alert this, how you can cancel, which I prefer this one.
There's one more when we can prompt these things from the user, but we're going to do that one.
So now you know how to do the alert a lot and you learn about predictive variables and data types in
JavaScript.
So thank you very much.
I hope you I will see you in the next one.
Watch the videos before and after.
Enjoy.