As we said previously, JavaScript is an object based programming language, and therefore in JavaScript,
almost everything is an object.
Object is a little bit complex data type, and we want to refer to it yet because the whole section
is waiting for you regarding objects.
So we have just said that almost everything is an object.
It means that there is something that is not an object in JavaScript and those are primitives.
JavaScript provides five types of primitive data string, no boolean undefined and no all right strengths
are used for storing and manipulating text.
Let's create variable and assign to its value as John.
Is an instructor.
You tell JavaScript that text is to be treated as text and not as code, simply by enclosing it with
the single quotes, let's log it in council.
I'd consider it like string.
So here we have our string, John is an instructor, instead of single quotes, we can use double quotes.
You see that we have the same results.
They work in the same way, but there is one important issue to note.
The number of calls must always to be matched.
It means that if something starts with double quotes, then must be and with double quotes as well.
And the same for single quotes.
If not, then the string value would be invalid.
So you see that we got syntax error, which tells us that the value is invalid.
And the last thing that I want to show you regarding strength is that if we want to surround one of
the words by quotes, for example, instructor, we have to protect the following group.
If the itself is surrounded by the double quotes, then we have to use single quotes with instructor.
So you see that instructor is in quotes.
OK, now let's see what happens if we don't protect this rule right here, double quotes reload and
we have, again, an error.
All right, let's see what has happened here, JavaScript engine rates, the code from left to right.
It has found the beginning of the string value with double quotes.
So also expect to see adding double quotes and when it finds that counts, that this piece of code is
correct.
But what it sees next is invalid.
Therefore, we get an error.
All right.
Let's move on to the numbers.
JavaScript has only one type of number.
Unlike like many other programming languages, JavaScript doesn't define different types of numbers,
like integers, short, long, floating port and etc. Numbers can be written with or without decimals.
So let's create variable and call it number equals to twenty seven, then luggage in council.
So we have here 27 and also you notice that the color is different from strong values.
It's kind of blue.
We can write numbers with decimals, as we said.
Right.
For example, point twenty three.
One thing to note regarding numbers is that if we write it within quotes, then the JavaScript engine
will understand that the type of value is stirring and not the number.
And it's actually the important thing because it may cause unexpected results.
And you will see that later.
You said that in console, nothing is changed till we have the same number.
The only thing that was changed is the color of the output.
As we said, numbers are always shown in blue and the color of the string is great.
All right, the next primitive data type is Bulleit, which has two possible values, true or false?
The idea of true and false is fundamental in computer programming.
The purpose of pulling data and javascript is just the same as in the world outside programming.
It enables you to answer questions and make decisions based on the answer, mostly boolean data types
that are used in conditional statements.
And just for demonstration purposes, I would like to show you this example.
Create variables, number one.
Equals to five.
And number two equals the ten.
Let's compare these numbers and counsel writes, No one is less than number two.
And he said that we have true because the statement is actually true, five is less than 10.
If we were right, the opposite number one is greater than number two.
Then the result will be false, and I'm sure you understand why.
All right, let's move on to the new variable and.
Then luggage in council.
And see what happens, you see that we have undefined now let's remove this line of code and reload
the page again.
You see that we got an error which tells us that A is not defined.
So what is the difference between undefined and is not defined?
In first case, when we got undefined means that Variable A is created and JavaScript engine has reserved
the memory space for it.
But because of that, the variable is not assigned by the value JavaScript engine automatically assigns
to it undefined, which is the special value, and also it belongs to primitive data type.
So, again, if the variable is declared and is not assigned by the value, it's undefined.
The second case in which we have got a is not defined means that variable itself doesn't exist.
In other words, JavaScript engine could not find the variable in its memory.
All right, let's talk about now, as we saw in previous example, undefined means a variable that has
been declared but has not yet been assigned a value now is an assignment value.
The right for A equals to null.
It can be assigned to the variable as a representation of no value, so the variable whose value is
undefined has never been initialized and the variable whose value is now was explicitly given a value
of null, which means that the variable was explicitly set to have no value.
In other words, NUL is nothing, and it's supposed to be something that doesn't exist.
So, again, Undefined is automatically assigned by JavaScript engine one, the variable does not have
value and we assign now to the variable in order to represent that this variable doesn't have the value.
Makes sense.
OK, it may be a little bit strange and confusing, but I think I made it clear for you.
All right, in this lecture we have discussed briefly primitive data types.
See you in the next video.
Let's go ahead.