Ram

Lesson 3 of 20

Operators

Calculate, compare and combine values.

Introduction

JavaScript uses arithmetic operators such as +, -, *, / and %. Comparison operators produce booleans.

Use === for strict equality and logical operators such as && and || to combine conditions.

Key insight

Calculate, compare and combine values.

Example

const price = 12;
const quantity = 3;
console.log(price * quantity >= 30);

This example shows the core operators idea in a small, runnable program.

Real-world example

Checkout totals and validation rules depend on operators.

Test yourself

2-question check

1

What is the main idea in Operators?

2

Where can operators be useful?

Ready to check your understanding?

Answer every question, then submit your quiz.

Try it yourself

JavaScript compiler

Runs in your browser. Nothing is sent to a server.

Output appears here

Practice challenge

Use % to check whether a number is even.

Previous
Next