- [Instructor] Now that we know how to declare
different types of variables.
The next question is what can be put inside those variables?
In JavaScript, the answer is pretty much anything.
JavaScript is a weekly typed language
meaning you don't have to declare
what type of data goes into your variables
you just fill the variable with whatever data you want
and then JavaScript will identify
or at least try to identify that data type for you.
In the exercise files for this movie
you'll find almost all of the data types
you can use in a variable.
Here we have first a string
it's defined by using quotation marks
at the beginning and end wrapping around the string.
Then we have an integer
this is just a number without quotation marks.
We also have a floating point number
so that's a number with a decimal to it.
The reason why it's called a floating point is
you can imagine a number and then you float a points
in between the numbers to indicate where the decimal starts.
That's the floating point right there
we have bullions that's a true or false value.
There is a no value
so nothing saying that this value contains nothing
it's just a clarity using the word null.
We have two types of undefined
one is when you create a variable
but don't assign anything to it
it automatically becomes undefined
or if you want to
you can actively assign the word undefined to a variable
and that means the variable again is undefined.
Then we have objects
we've covered this extensively previously in the course
you'll remember an object is defined
by putting curly brackets
around some different properties and values
and finally, we have an array
which we'll cover in the next chapter
arrays are are likewise defined
by using a square bracket at the beginning and end
and then inside the array
we have a comma separated list of items
and these items can then be any one of the other data types.
So we can have a string and a number and an object
and another array
whatever you want inside each of these slots in the array.
Jumping over to the console, we get the outputs
of all these different data types,
string, integer, floating point number, bullion value,
no value, unidentifying two versions of that,
an object and an array.
What you should take away from this is JavaScript
does not care what type of data you put in a variable
it just stores that data.
If you want to find out what data type
JavaScript has identified an assigned value to B,
you can use a type of operator.
So here we can say type of,
so here in front of any of these values,
we can say type of, save it.
So here in front of any of these variables
when we console log it out, we can just say type of
and in the console
it'll tell us what type of content this is.
It'll say string in this case, because it is a string
and if I go down here, let's see
it'll say number because it's a number.
So, integers and floating point numbers
are both registered as numbers.