JavaScript - Operators : Arithmetic, Relational, Logical and Ternary Flashcards

1
Q

What are JavaScript operators?

A

Symbols that perform operations on values and variables.

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

What are the three main types of JavaScript operators?

A
  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of Arithmetic Operators?

A

Used for mathematical operations/calculations.

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

What does the Addition operator (+) do in JavaScript?

A

Performs addition of two values.

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

What is the result of the operation 5 + 3?

A

8

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

What does the Subtraction operator (-) do in JavaScript?

A

Performs subtraction of two values.

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

What is the result of the operation 10 - 4?

A

6

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

What does the Multiplication operator (*) do in JavaScript?

A

Performs multiplication of two values.

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

What is the result of the operation 6 * 2?

A

12

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

What does the Division operator (/) do in JavaScript?

A

Performs division of two values.

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

What is the result of the operation 15 / 3?

A

5

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

What does the Modulus operator (%) do in JavaScript?

A

Returns the remainder of a division operation.

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

What is the result of the operation 17 % 5?

A

2

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

What are Relational Operators used for?

A

Used to compare values, returning either true or false.

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

What does the Greater than operator (>) check?

A

Checks if the left value is greater than the right value.

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

What is the result of the operation 5 > 3?

17
Q

What does the Less than operator (<) check?

A

Checks if the left value is less than the right value.

18
Q

What is the result of the operation 2 < 1?

19
Q

What does the Equal to operator (==) check?

A

Checks if two values are equal.

20
Q

What is the result of the operation 4 == 4?

21
Q

What does the Not equal to operator (!=) check?

A

Checks if two values are not equal.

22
Q

What is the result of the operation 5 != 3?

23
Q

What are Logical Operators used for?

A

Used to combine or modify conditions.

24
Q

What does the AND operator (&&) return?

A

true if both conditions are true.

25
What does the OR operator (||) return?
true if at least one condition is true.
26
What does the NOT operator (!) do?
Reverses the boolean value.
27
Fill in the blank: The operator that returns the remainder of a division operation is called the _______.
Modulus operator
28
Why are ternary operators used?
They are one liners of code and are quite useful for quick and simple decisions.
29
What is the Syntax (code outline) for Ternary Operators?
condition ? expressionIfTrue : expressionIfFalse
30
What is an example of code (in Javascript) for Ternary Operators?
let canDrive = age >= 16 ? "Yes" : "No";