TGViewer
Web Development Web Development @webdevcoursefree · 79.7K subscribers
Post #3474 4.18K
Now, let's move to the the next topic:

✅ JavaScript Fundamentals

📌 Variables, Data Types, Operators

❓ What JavaScript is
- JavaScript makes web pages interactive
- Runs in the browser
- Controls logic and behavior

HTML → structure
CSS → design
JavaScript → brain

📦 Variables (Storing data)
Variables store values in memory.

Three ways to declare variables:
🔹 let
• Value can change
• Block scoped
• Most commonly used

🔹 const
• Value cannot be reassigned
• Used for fixed values

🔹 var
• Old style
• Function scoped
• Avoid in modern JS

Example:
let age = 25;
const name = "Deepak";

🧾 Data Types in JavaScript

JavaScript is dynamically typed.

🔢 Number let score = 90;

📝 String let city = "Delhi";

✅ Boolean let isLoggedIn = true;

📦 Undefined let x;

🚫 Null let data = null;

🧠 Object let user = { name: "Amit", age: 30 };

📚 Array let skills = ["HTML", "CSS", "JS"];

➕ Operators Explained

🔹 Arithmetic Operators + - * / %
🔹 Assignment Operators = += -=
🔹 Comparison Operators == === != !== > <

Important rule
• == checks value only
• === checks value + type

Always use ===

🔀 Logical Operators
- AND → &&
- OR → ||
- NOT → !

Example: age > 18 && isLoggedIn

⚠️ Common Beginner Mistakes
- Using var
- Mixing string and number
- Using == instead of ===
- Forgetting const for fixed values

🧪 Mini Practice Task
- Create variables for name, age, isStudent
- Create an array of skills
- Compare age with 18
- Print result using console.log

✅ Mini Practice Task – Solution 🧠

📌 1️⃣ Create variables for name, age, isStudent
const name = "Deepak";
let age = 25;
let isStudent = true;

- const used for fixed value
- let used where value may change

 

📚 2️⃣ Create an array of skills
let skills = ["HTML", "CSS", "JavaScript"];

- Arrays store multiple values
- Order matters

 

🔍 3️⃣ Compare age with 18
let isAdult = age >= 18;

- Returns true or false

 

🖨️ 4️⃣ Print result using console.log
console.log("Name:", name);
console.log("Age:", age);
console.log("Is Student:", isStudent);
console.log("Skills:", skills);
console.log("Is Adult:", isAdult);

➡️ Double Tap ♥️ For More
  • ❤ 24
More from @webdevcoursefree
  1. Oct 14, 2026🌐 Web Development Roadmap — Part 17 HTML Images — <img> Tag Images make webpages more vis…
  2. Oct 13, 2026𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explor…
  3. Oct 12, 2026For example: Go to Profile → <a> Submit Form → <button> Open Article → <a> Delete Account…
  4. Oct 12, 2026🌐 Web Development Roadmap — Part 16 HTML Links — Tag Links are one of the most important…
  5. Oct 12, 2026🚀 𝗪𝗵𝗶𝗰𝗵 𝗧𝗲𝗰𝗵 𝗦𝗸𝗶𝗹𝗹 𝗪𝗶𝗹𝗹 𝗬𝗼𝘂 𝗠𝗮𝘀𝘁𝗲𝗿 𝗶𝗻 𝟮𝟬𝟮𝟲? Want to buil…
  6. Oct 9, 2026Post #4079
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →