JavaScript (Operators) Flashcards

(22 cards)

1
Q

JavaScript provides several ____ that
allow you to perform basic mathematical operations.
These are similar to operators found in other
programming languages and calculators

A

arithmetic operators

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

Adds two numbers.
Also used for string concatenation
Example: 10 + 3 = 13

A

Addition (+)

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

Subtracts the second number from the first.
Example: 10 - 3 =

A

Subtraction (-)

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

Multiplies two numbers.
Example: 10 * 3 = 30

A

Multiplication (*)

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

Divides the first number by the second.
The result can be a floating-point number.
Example: 10 / 3 = 3.3333

A

Division (/)

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

Returns the remainder of a division.
Often used to determine if a number is even or odd.
Example: 10 % 3 = 1

A

Modulo (%)

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

Raises the first number to the power of the second number.
Equivalent to Math.pow(a, b).
Example: 10 ** 3 = 1000

A

Exponentiation (**)

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

allow developers to
compare values. These comparisons return a Boolean
(true or false) and are fundamental for making decisions
in code.

A

Comparison

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

Types of Comparison
Operators

A
  • Equality
  • Inequality
  • Relational Comparison
  • Comparison in Conditional Statements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Compares values but ignores
type differences.

console.log(5 == “5”); // true

A

Loose Equality (==)

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

Compares both value and
type

console.log(5 === “5”); // false

A

Strict Equality (===)

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

Checks if values are
different, ignoring type.

console.log(5 != “5”); // false

A

Loose Inequality (!=)

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

Checks if values and types
are different.

console.log(5 !== “5”); // true

A

Strict Inequality (!==)

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

Relational Comparison Operators

A
  • Greater than (>)
  • Less than (<)
  • Greater than or equal to (>=)
  • Less than or equal to (<=)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

help evaluate conditions that involve
multiple Boolean expressions. They return either true
or false depending on how the conditions interact.

A

Logical operators

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

Types of Logical
Operators

A

AND (&&)
OR (||)

17
Q

Returns true if both conditions are true

18
Q

Returns true if at least one condition is true

19
Q

Reverses the Boolean value

20
Q

Logical operators evaluate expressions from left to right,
sometimes stopping early

TRUE OR FALSE

21
Q

is a shorthand
way to write an if-else statement. It evaluates a
condition and returns one of two values based on
whether the condition is true or false

A

Ternary Operator

22
Q

Operators with
higher
precedence
execute before
lower-precedence
ones.

TRUE OR FALASE