So let's take a look at some data type examples have copied our starter program, and the first thing
I want to do is see what type this hello world string is.
So that I can do is add a parameter to this list and say type of and then after repeated Hello world.
So let's take a look at that.
I'm going to start up the live server.
Pull over to the right of the console window and we see we have our strength whole world, and it tells
us that it is a strength.
So let's put in a few other types.
So I'll say cancel that log 55 type of 55,
cancel that log.
True
type of true.
Let's run that again, we 55 is no and true is a boolean value.
So we've done this with literals and literals, as I mentioned, cannot be reused.
So we have a hollow road here and we have a hollow road there to literals to 55 to True's.
So let's do the same thing except with with variables.
So
I'm going to say, let alone string equals overworld world.
And I'm going to kind of repeat this council dialogue with the hello's string.
Now, in this case, the string is only used once, it only exists once, but it's used twice.
So it's the same hollow string.
Let's add a couple others will say, but no value equals fifty six.
Let true value equals false.
And I'm going to do a little copying and pasting take or no value there.
So there we'll take our true value.
Placed it there and pasted there.
Okay, let's run this.
So here's our second set.
Hello, Broadstone.
Stranraer 56 is still a number and our forces are buia.
So what about undefined.
What comment?
A few of these out to avoid confusion.
So you get undefined by declaring a variable, let's say undefined value and you don't give it a value.
So it is undefined, makes little sense.
So if I consolo this out
into a type of
what we should get is that it's undefined, let's run it.
So the value of it is undefined in its type is also undefined now because JavaScript has dynamic data
dynamically defined.
I can turn right around then say undefined value equals sixty six and log that out.
I don't know why I'm typing when I could just copy.
So now UNDEF value is sixty six in this type of number, and then we can turn around and change that
yet again and say on that value equals hello again and load it out again.
And
now it's a straight.
So it's really different with JavaScript compared to some other languages, once you define a variable
in many languages.
Next up, we have constants as well as what if we define a constant value?
We have to give a value
and then we log that out.
The problem comes if you try to change it, it's not a problem because what you want is a constant value.
So if I said my value goes one on one and try to log it out again to copy.
So now we're going to get in there because it's an assignment to a constant variable, so you can't
do that.
All right.
Come at these out.
Let's take a look at the use strict.
So this is the strict.
So what you strict does not allow you to do is to say new value equals five.
That's not allowed.
Cancel that log.
New value.
So if I try to run this.
I'm going to say new values, not to find that I go back and comment about the strict, it's going to
allow it.
So now it's loud, but we don't want that it can cause too many problems to have accidental and declare
variables.
All right, the next thing is, why don't we want to use the vaki word, if you look at much JavaScript,
you'll see the VA keyword everywhere.
So let's talk about why that's important and why that's a problem.
So if I say VA X equals 30 and then I'm going to find some scope, a block of scope and we'll see more
of this later when we get to conditionals and looping and things like that.
But you can just say love.
Curly Brace recalibrates and that's a new block of scope.
And then I can say, let's say four X equals 20 and then let's talk this out.
OK, and then let's copy this before we get to this block and after.
So what's going to happen is that the VA is global.
So I'm going to close the first VA X, it can be 30, but this X is going to be the same X.
And what we want is for it to be a different X.
So when we change the 20 is still 20 at the end.
So we want when we declare variables inside of a curly brace, we want them to be local to that curly
brace and be forgotten afterwards.
So that's where it comes in.
So if I say let X equals 30, let X equals 20.
And we'll run it one more time
than you can see, it started out as 30.
It got changed to 20.
It did not change.
It declared a new variable X and gave it a value of 20 inside of this block.
But then after the block, the other X was still 30.
All right, so that's a introduction to data types.
Next, we'll move on to operators and actually do something with this data.