Javascript-if Flashcards
Give 6 examples of comparison operators.
”>” greater than, “>=” greater or equal to, “==”equal to, “===” strictly equal to, “!=” is not equal to, “!==”strictly not equal to.
What data type do comparison expressions evaluate to?
boolean
What is the purpose of an if statement?
the purpose is decision making. an if statement evaluates conditions and determine which code should be run.
Is else required in order to use an if statement?
no, if you only need the code to run when the if statement returns true, and do nothing else when the condition is false, then the else statement is not needed.
Describe the syntax (structure) of an if statement.
it starts with if, followed by parentheses, and inside of parentheses, there usually two operands being compared. and after the closing parenthesis, there would be the curly braces with the conditional statement.
What are the three logical operators?
&& logical and, || logical or, ! logical not.
How do you compare two different expressions in the same condition?
you can use parentheses for each expression and connect them with logical operators.