We'll come back to lesson six, null and undefined, this means no is it intentionally points to a non-existent
or invalid object address.
Think of a room that explicitly has been marked as empty.
And then undefined is a little bit different, that's assigned to a variable that was just created,
just declared, but no value has been assigned to it yet.
So it's not explicitly empty.
It's as if there is no room there.
So it's kind of the difference between having a room that's, you know, is empty and having a room
that you haven't visited yet.
So you don't know what's in it.
So we're going to look at these in code and learn a little bit more about them.
OK, so here we are and there's not a ton to get into right here, but basically we can.
Just do some sample variables and let's just say we declare this variable, variable one.
Now, if we just go ahead and cast a long time,
then we're not going to get a specific value.
What we are going to get, though, is this value undefined?
It's not necessarily a problem that a variable is undefined.
It's OK if it doesn't have a value, certain variable types.
It's not OK if they don't have a value.
So const, for example, it's going to shout at you, hey, since you're not going to be able to edit
this value later, you need to initialize some value in this declaration so you're not going to find
const variables that are undefined.
But we could set this to know if we wanted to.
We totally could and give it in no value.
So that means it's explicitly empty.
What's fantastic about this is now we have a variable that is always going to be No.
Very interesting.
So since we can't reassign it to any other thing, right.
Remember how we can't give this a separate value later because it will catch us and be like, hey,
you cannot assigned to a constant variable, stop that.
So we're better off just like that.
And we have null and undefined.
So in computer science and no value is it represents a reference that points intentionally to a non-existent
or invalid address, so that varies among languages.
But basically here we're just saying this has no value, which if you interpret this as a true or false
value, it is false.
OK, it's fairly primitive, but as far as it being a primitive data type like numbers and strings,
but there are other things that you can do with this involving objects, and we'll learn about those
later as well.
Now, undefined, if you recall from this other example, you can't do it.
So let's do let.
So if we just set this up and just give it no value, we just declared it, but we did not sign anything.
It is undefined.
OK, so this comes in handy when we need to calculate the variable value later or if the value is dependent
on the user's input so we can just create a variable now and use it later.
So we'll see later on.
We want to reset the value to some user information.
So we'll just we'll just prompt for for some value.
And then we see a.
And then we could on that as well at the end.
So let's say, hey, and there you go, the prompt spat out, the answer to that prompt prompt is a
really cool thing.
You can as you can see, you can use it to just make a little quiz question anywhere you want.
Prompts are used a lot for authentication on websites.
Hey, you need to log in, put your password in things like that.
Just built right into JavaScript is very basic, basic function, as you can see.
OK, that is it for null and undefined.
And we will come back to you to.