IF Statement Worksheet

Question 1

Why is an IF statement known as a control structure?

IF statements can forward a user down an entirely different path of code.

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.

Conditional Statements (including IF statements), Looping Statements, and Jumping Statements. Each category has a few different types.
cited: Metana.IO

Question 3

What is a boolean expression?

A boolean expression is an expression that's answer is only either 'true' or 'false' (it defaults to false)

Question 4

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

the Equality Operator (two equal signs) is used to evaluate an absoloute match for a variable's given value - an assignment operator (one equal sign) works to
initialize a variable's value.

Question 5

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

There can potentially be errors throughout a group of identical looking lines of code - indentation
can make it easier to catch mistakes in syntax or typos.

Question 6

What is a code block in JavaScript?

A code block refers to the body of a single function or command.

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.