IF Statement Worksheet

Checkout this page to review the concepts we covered in class regarding IF statements.

Question 1

Why is an IF statement known as a control structure?

IF statement are know as control structure because if it is ture it go down one side of the tree.

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.

conditionals (if-else, switch) that perform different actions depending on the value of an expression, loops (while, do-while, for, for-in, for-of), that execute other statements repetitively, jumps (break, continue, labeled statement) that cause a jump to another part of the program.

Question 3

What is a boolean expression?

True or flase

Question 4

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

= = it is use to see if something is equal to manly in if statement. The assignment operator assign a value.

Question 5

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

To make sure that it looks uniformed and it is easier to see any mistakes.

Question 6

What is a code block in JavaScript?

keyword(){
what needs to happen if it is true
}

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.