Decisions with If/Else Statements

7th GradeComputer Science50 min

Learning Objective

I can write code using "if/else" statements to make decisions in JavaScript.

Lesson Flow

Watch Video

11 min

Learn JavaScript Episode #7: If/Else Statements

Joseph Delgadillo

Guided Notes

10 min

Key concepts students will learn:

  • An `if` statement in JavaScript starts with the keyword if, followed by a comparison in parentheses, and code to execute in curly brackets.

  • If the condition in an `if` statement is not true, an else statement can be used to execute alternative code.

  • The `else if` statement lets you check multiple conditions in a sequence, executing the code block for the first condition that evaluates to true.

Practice

15 min

10 questions • Multiple choice & Short answer

Exit Ticket

5 min

Write a JavaScript code snippet that checks if a variable called 'score' is greater than or equal to 70. If it is, print "You passed!". Otherwise, print "Try again.".

Teacher Guide

Get the complete package:

  • Answer keys for all questions
  • Differentiation strategies
  • Extension activities
  • Printable student handouts