JavaScript - Operators : Arithmetic, Relational, Logical and Ternary Flashcards
What are JavaScript operators?
Symbols that perform operations on values and variables.
What are the three main types of JavaScript operators?
- Arithmetic Operators
- Relational Operators
- Logical Operators
What is the purpose of Arithmetic Operators?
Used for mathematical operations/calculations.
What does the Addition operator (+) do in JavaScript?
Performs addition of two values.
What is the result of the operation 5 + 3?
8
What does the Subtraction operator (-) do in JavaScript?
Performs subtraction of two values.
What is the result of the operation 10 - 4?
6
What does the Multiplication operator (*) do in JavaScript?
Performs multiplication of two values.
What is the result of the operation 6 * 2?
12
What does the Division operator (/) do in JavaScript?
Performs division of two values.
What is the result of the operation 15 / 3?
5
What does the Modulus operator (%) do in JavaScript?
Returns the remainder of a division operation.
What is the result of the operation 17 % 5?
2
What are Relational Operators used for?
Used to compare values, returning either true or false.
What does the Greater than operator (>) check?
Checks if the left value is greater than the right value.
What is the result of the operation 5 > 3?
true
What does the Less than operator (<) check?
Checks if the left value is less than the right value.
What is the result of the operation 2 < 1?
false
What does the Equal to operator (==) check?
Checks if two values are equal.
What is the result of the operation 4 == 4?
true
What does the Not equal to operator (!=) check?
Checks if two values are not equal.
What is the result of the operation 5 != 3?
true
What are Logical Operators used for?
Used to combine or modify conditions.
What does the AND operator (&&) return?
true if both conditions are true.