IF Statement Worksheet
Question 1
Why is an IF statement known as a control structure?
It allows you to control the flow of your program based on certain conditions.
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.
switch, for, while do...while, for...in, for...of. break, continue, return.
Question 3
What is a boolean expression?
A boolean evaluates to either true or false.
Question 4
What is the 'equality operator', and what is it used for? How is it different from the assignment operator?
It is used to compare 2 values to determine if they are equal. Loose equity (==)
Question 5
Why is it important to properly indent your code when writing IF statements?
It is important for de bugging purposes. Proper indentation will help with this.
Question 6
What is a code block in JavaScript?
A code block in JS is a group of one or more statements enclosed in curly brackets.
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.