• 15 hours
  • Easy

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Got it!

Last updated on 5/4/22

Check what you've learned about program logic!

Log in or subscribe for free to enjoy all this course has to offer!

Evaluated skills

  • Manage program logic in JavaScript (conditions, loops, and errors)
  • Question 1

    What is the value of  message at the end of this code snippet?

    let online = true;
    let message = '';
    if (online) {
    message = 'User online!';
    } else {
    message = 'User offline!';
    }
    • ''

    • 'User online!'

    • 'User offline!'

  • Question 2

    What is the value of  passengersBoarded  at the end of this code snippet?

    let passengersBoarded = 0;
    if (passengersBoarded <= 10) {
    passengersBoarded += 10;
    } else {
    passengersBoarded -= (passengersBoarded - 10);
    }
    • 0

    • -10

    • 10

  • Question 3

    What is the value of  passengersBoarded at the end of this code snippet?

    let passengersBoarded = 18;
    if (passengersBoarded <= 10) {
    passengersBoarded += 10;
    } else {
    passengersBoarded -= (passengersBoarded - 10);
    }
    • 10

    • 18

    • 0

    • 28