Transcript from the "Booleans" Lesson
>> Brian Holt: So I'm actually just gonna delete all of this,
>> Brian Holt: const isTheSkyBlue. Actually, it's kind of gray today if we're being honest. But well, let's just roll with blue for now. True, okay, and then I can just say console.log isTheSkyBlue. Refresh here, notice that it says false. [LAUGH] Just kidding, it says true.
[00:00:32] So these are called Booleans. It's literally true or false, those are the only two options, and these are quite useful, we use them quite a bit in programming. Like imagine that you were making smart lights or something like that, you would have like are the lights on and that would be either true or false.
And you would flip that back and forth depending on whether or not the person had turned on the lights. Again, this is called a Boolean,
>> Brian Holt: Like that, that's how you spell it. I believe it's named after a computer scientist named Bool. Don't quote me on that though, it's been a long time since I was in school.
>> Brian Holt: And again, this can be either true or it can be false.
>> Brian Holt: So that's another one to keep in mind. Yeah, please.
>> Speaker 2: Does it have a default value if you didn't assign it to the thing?
>> Brian Holt: So like if I did this, one with const, you can't do that because const instance can never be reassigned, right?
But if I did let like this, it would be undefined because we haven't defined it. So the default value is undefined.
>> Brian Holt: Yeah, and then if you don't define it all it says isTheSkyBlue is not defined at all, so then it gets upset at you.
>> Speaker 3: Does it become a Boolean just because we are defining it as true?
>> Brian Holt: So when it dynamically moves from a string to a number to myName = true, to Boolean, it does not matter, it just keeps up with it.
>> Brian Holt: This makes it really easy to code because that's just one thought process you don't have to think about, but you get bugs from it. So it's a trade-off.