Operators
In programming, symbols such as plus (+), minus (-), multiply (×), and divide (÷) are called Operators
.
Operators are used to process data (values) and create new values.
Frequently used operators include arithmetic operators, comparison operators, and logical operators.
Arithmetic Operators
These perform basic mathematical operations like elementary arithmetic.
-
+
: Addition -
-
: Subtraction -
*
: Multiplication -
/
: Division -
%
: Modulus
let result = 5 * 3; // 5 x 3 = 15 is stored in result
Comparison Operators
They compare values or variables and return a boolean value, either true or false.
-
==
: Equal to (compares only values) -
===
: Strict equal to (compares values and types) -
!=
: Not equal -
!==
: Strict not equal -
>
: Greater than -
<
: Less than -
>=
: Greater than or equal to -
<=
: Less than or equal to
let isTrue = 5 > 3; // 5 > 3 results in true being stored in isTrue
Logical Operators
These are used to combine multiple conditions to determine a boolean value, true or false.
-
&&
: AND - true only if both are true -
||
: OR - true if at least one is true -
!
: NOT - inverts true to false and false to true
let value = true && false; // true && false results in false being stored in value
What is the most appropriate term to fill in the blank?
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help
Code Editor
Execution Result