• 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 1/19/24

Check what you've learned about program logic!

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

Ever considered an OpenClassrooms diploma?
  • Up to 100% of your training program funded
  • Flexible start date
  • Career-focused projects
  • Individual mentoring
Find the training program and funding option that suits you best