Comparisons, Variables, Logical Operators Flashcards

1
Q

What are comparison operators?

A

They are used in logical statements to determine equality or difference between variables or values.

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

What does the “ == “ comparison operator represent?

A

Equal to

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

What does the “ === “ comparison operator represent?

A

Equal value and equal type

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

What does the “ != “ comparison operator represent?

A

Not equal

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

What does the “ !== “ comparison operator represent?

A

Not equal value or not equal type

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

What does the “ > “ comparison operator represent?

A

Greater than

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

What does the “ < “ comparison operator represent?

A

Less than

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

What does the “ >= “ comparison operator represent?

A

Greater than or equal to

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

What does the “ <= “ comparison operator represent?

A

Less than or equal to

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

What are Logical Operators?

A

Logical operators are used to determine the logic between variables or values.

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

What does the “ && “ logical operator represent?

A

And.
Sees if both values are the same/true.
Given that x = 6 and y = 3,
(x < 10 && y > 1) is true.

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

What does the “ || “ logical operator represent?

A

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.

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

What does the “ ! “ logical operator represent?

A

Not.
Turns true into false, and false into true.
Given that x = 6 and y = 3,
!(x == y) is true.

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

What are Variables?

A

Variables are containers for storing values.

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

What are the 3 key words used to declare Variables?

A

Var, Let, and Const.
var price1 = 5;
const price2 = 6;
let total = price1 + price2;

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

When should the “ var “ keyword be used to declare a variable?

A

Only if you MUST support old browsers.

17
Q

When should the “ const “ keyword be used to declare a variable?

A

Always use const if the value should not be changed or when the type should not be changed (Arrays and Objects).

18
Q

When should the “ let “ keyword be used to declare a variable?

A

When the value of the variable changes. Only use let if you can’t use const.