From the course: JavaScript Essential Training

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Conditional if...else statement

Conditional if...else statement - JavaScript Tutorial

From the course: JavaScript Essential Training

Conditional if...else statement

- [Narrator] Much of programming centers around conditional logic statements. If this condition is true, then do this. If not, then do the other thing. The if else statement is the most basic and probably most used conditional statement in JavaScript and most other programming languages. So let's take a closer look at how this works 'cause you'll use it all the time. In the exercise files for this movie, I've brought back our backpack packer example. Now, if we look at it in the browser, there's one thing in this example that's really irking me and it's down here at the bottom. It says lid status: false. This makes sense if you know what it means, but it's not really the way we would communicate the lid status. We would say lid status open or closed, right? Now, the reason why it says false is because in the code we're just outputting the value of this property inside the everyday pack object. And it's a Boolean value…

Contents