Comparisons, Variables, Logical Operators Flashcards
What are comparison operators?
They are used in logical statements to determine equality or difference between variables or values.
What does the “ == “ comparison operator represent?
Equal to
What does the “ === “ comparison operator represent?
Equal value and equal type
What does the “ != “ comparison operator represent?
Not equal
What does the “ !== “ comparison operator represent?
Not equal value or not equal type
What does the “ > “ comparison operator represent?
Greater than
What does the “ < “ comparison operator represent?
Less than
What does the “ >= “ comparison operator represent?
Greater than or equal to
What does the “ <= “ comparison operator represent?
Less than or equal to
What are Logical Operators?
Logical operators are used to determine the logic between variables or values.
What does the “ && “ logical operator represent?
And.
Sees if both values are the same/true.
Given that x = 6 and y = 3,
(x < 10 && y > 1) is true.
What does the “ || “ logical operator represent?
Or.
Sees if there is at least one of the same/ true value.
Given that x = 6 and y = 3,
(x == 5 || y == 5) is false.
What does the “ ! “ logical operator represent?
Not.
Turns true into false, and false into true.
Given that x = 6 and y = 3,
!(x == y) is true.
What are Variables?
Variables are containers for storing values.
What are the 3 key words used to declare Variables?
Var, Let, and Const.
var price1 = 5;
const price2 = 6;
let total = price1 + price2;