Let's finish up with a conditional statement by talking about two, three and four C values, because
I have kept mentioning about true fee and foresee values many times, but we haven't talked about.
So this is the time.
So what is true fee and what is false values?
So with the picture even explain everything.
So let's get going.
Let me show you what it means.
Okay.
So in JavaScript, a true free value is a value that considered true when evaluated in a boolean context.
All values are true values unless they are defined as forcing.
So it simply means that.
So let me have some space here and let me comment out this.
Once you are done with that, I'll provide the source code for you if want to have a look.
So here is.
That.
And let's talk about true fee.
Trophy and forcing values.
So trophy values simply means that when the logic is being evaluated in the context of a boolean, then.
It's considered to be true because now you made mention of the E!
Statement, so it's time to talk about the truth and false values.
So an example of true field values and then example of the forsey values.
So value, which considered to be false is called false values.
And one is the.
Force itself.
And then next one is zero.
Next one is empty string.
Next one is narrow and next one is undefined.
So apart from these ones, any other value is considered to be true.
So a moment of truth.
Now let's declare a variable here.
Let's let
each simple one is equal to empty string.
So now if I evaluate this one in a boolean context, that means if statement or you can use ternary
operator.
Unless make your if statement.
So if h.
Meaning if h exists.
Meaning this code is going to run.
Let me see.
Yes.
It is true else.
It is false value.
Then.
Console that log.
You will say.
Sorry.
It is false.
So save it now and see that it is false because it is an empty string, which is the.
So it is false.
If I change this 1 to 0 zero is false value.
Right?
So it's going to be false.
So this code run, if I save the code again still I still see.
Sorry, it is false.
If I change the edge to now if I save it refresh it is still false because Noor is considered to be
forcing.
If I change this one to undefined again, undefined here is false value.
So it's going to be also asked false, which is this.
But if I provide even zero here you are h zero again is false.
So pay attention to this.
It's really important.
We are trying to make condition perfect.
So any other value apart from this is considered to be true.
So if I provide, let's say 20.
If I save it.
Yes, it is true.
If I provide even a string.
Yes, it is true that provide.
Yes, whatever.
Here is a string.
Yes, it is true.
So any other value apart from force values are considered to be true.
So when making conditions pay attention to these values, it's really important.
The next video.
Let's get started with JavaScript loops.
That is repetition of task.