Setting Comparison Operators Flashcards

1
Q

What are the assignment, equality and strict equality operators?

A

= assignment
== equality
=== strict

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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 ===
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the comparison operator for AND / OR logic operators?

A

AND ( a === b && c === d);

OR ( a === b || c === d);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the operator for NOT equal to?

A

!==

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

RANDOM QUESTION:

What is the shorthand for iteration of +1 to a variable?

A

var++;
OR
var += var

How well did you know this?
1
Not at all
2
3
4
5
Perfectly