JavaScript Variables Fundamentals

Starting my JavaScript learning journey — sharing what I learn every day. 🚀 📅 JavaScript Learning Journey — Day 4 Today I learned one of the most important fundamentals in JavaScript — Variables. Variables are used to store data so we can use and manipulate it later in our code. 🔎 What is a Variable? A variable is like a container that holds a value. 💡 Example: let name = "Redoan"; console.log(name); 🧠 Types of Variables in JavaScript There are 3 ways to declare variables: 1️⃣ var (Old way) var age = 20; 2️⃣ let (Modern & recommended) let city = "Dhaka"; 3️⃣ const (Constant value) const country = "Bangladesh"; ⚠️ Difference (Important) • "var" → can be re-declared & has function scope • "let" → can be updated but not re-declared • "const" → cannot be updated or re-declared 📌 Rules for naming variables • Cannot start with number • No spaces allowed • Use meaningful names (best practice) 📌 Key Takeaways (Day 4) • Variables store data • Use "let" and "const" in modern JavaScript • Avoid using "var" in most cases This is Day 4 of my JavaScript learning series. Next, I’ll explore Data Types in JavaScript. #JavaScript #WebDevelopment #FrontendDeveloper #LearningInPublic #100DaysOfCode #programinghero

To view or add a comment, sign in

Explore content categories