Setting Comparison Operators Flashcards
1
Q
What are the assignment, equality and strict equality operators?
A
= assignment
== equality
=== strict
2
Q
What are the differences in the = / == / === operators?
A
= assigns value to a variable.
== assigns value to a variable (usually a general variable) data variable/data type do not matter.
=== assigns value to a variable but Date Type and Variable Type MUST MATCH.
3
Q
Will this work? var a = 456; var b = "456"; if (a == b) { alert("yes they are equal"); } else { alert("no they are not"); }
A
- Yes it will.
- *JS sees the numerical literal and the string literal as equals.
- ** To fix this, use strict ===
4
Q
What is the comparison operator for AND / OR logic operators?
A
AND ( a === b && c === d);
OR ( a === b || c === d);
5
Q
What is the operator for NOT equal to?
A
!==
6
Q
RANDOM QUESTION:
What is the shorthand for iteration of +1 to a variable?
A
var++;
OR
var += var