Lecture

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

Multiplication Arithmetic Operator
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


Greater Than Comparison Operator
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

AND Logical Operator
let value = true && false; // true && false results in false being stored in value
Mission
0 / 1

What is the most appropriate term to fill in the blank?

Symbols like addition, subtraction, multiplication, and division correspond to .
Comparison operators
Logical operators
Arithmetic operators
Ternary operator

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help

Code Editor

Run

Execution Result