IF Statement Worksheet

Question 1

Why is an IF statement known as a control structure?

An IF statement is called a control structure because it helps control what happens in a program. It checks if a condition is true or false, and based on that, it decides which part of the code to run.

Question 2

There are other control structures in JavaScript that we'll be learning about soon. Use your google skills to look up the other control structures in JavaScript and list them below.

Question 3

What is a boolean expression?

A boolean expression is something that can be either true or false. It's used to make decisions in a program.

Question 4

What is the 'equality operator', and what is it used for? How is it different from the assignment operator?

The equality operator is used to check if two values are the same. In JavaScript, it's written as ==

Difference from the Assignment Operator:

Question 5

Why is it important to properly indent your code when writing IF statements?

Properly indenting your code when writing IF statements is important because:

Question 6

What is a code block in JavaScript?

A code block in JavaScript is a group of code that's inside curly braces { }. It lets you group multiple lines of code together to be treated as one

Coding Problems

Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.

Always test your work! Check the console log to make sure there are no errors.