➕ Lesson 3: JavaScript Operators
⏱️ Estimated time: 15 minutes | Difficulty: Beginner
Logic and Math
JavaScript operators are used to perform different types of mathematical and logical computations.
What is a Variable?
A variable stores information. It's like a labeled box where you put data.
Creating Variables (let, const, var)
// Using let (recommended)
let name = "Alice";
let age = 25;
// Using const (for values that don't change)
const PI = 3.14159;
const gravity = 9.8;
console.log(name); // Alice
console.log(age); // 25
Data Types
String
let city = "NYC";
let msg = 'Hello';
Number
let age = 25;
let price = 19.99;
Boolean
let isStudent = true;
let isActive = false;
Changing Variables
let score = 10;
console.log(score); // 10
score = 20;
console.log(score); // 20
score = score + 5;
console.log(score); // 25
✅ Quick Quiz
❓ How do you create a variable in JavaScript?
❓ What's the difference between let and const?
❓ What will this output?
let x = 5; x =
x + 3; console.log(x)