Javascript
JavaScript Fundamentals -- Logical and Comparison Operators

Logical Operators -- And Exercise

Mute
Current Time 0:00
/
Duration Time 0:00
Loaded: 0%
Progress: 0%
Stream TypeLIVE
Remaining Time -0:00
 
PRO

For the exercise for this section, complete the expression or determine what its output will be

// 1. dog && dog.breed
const dog = {
  breed: 'Labradoodle'
}

// 2. What is the value of name?
const name = dog && dog.name;

// 3. Provide values for val1 and val2 so that you enter the if statement.
const val1;
const val2;
if (val1 && val2) {
  console.log('You made it into the if statement')
}

Fork this StackBlitz project to do the exercise.

 

I finished! On to the next chapter