javascript-if Flashcards
Give 6 examples of comparison operators.
== , ===, < , > , !=. !==
What data type do comparison expressions evaluate to?
boolean
What is the purpose of an if statement?
to compare an expression. Based on the result of that comparison the code will execute one or more statements else the code does something different or just skips the step.
Is else required in order to use an if statement?
no
Describe the syntax (structure) of an if statement.
keyword ‘if’ followed by the condition in paranthesis folowed by an opening curly brace then the code to execute if value is true and a closing curly brace.
if ( {condition} ) {
//Code to be executed if true
}
What are the three logical operators?
‘&&’ - Logical And - ‘||’ Logical Or - ‘!’ Logical Not
How do you compare two different expressions in the same condition?
by using a logical operator between them or an else if statement