TGViewer
Web Development - HTML, CSS & JavaScript Web Development - HTML, CSS & JavaScript @javascript_courses · 55.7K subscribers
Post #3174 5.78K
✅ JavaScript Basics – Part 1: Variables, Data Types & Operators 🧠📜

1️⃣ Variables in JavaScript
Variables store data. In modern JS, we use let and const.

let age = 25;          // Can be changed
const name = "Riya"; // Cannot be changed

📝 Use let when the value will change, const when it won’t.

2️⃣ Data Types
JavaScript is dynamically typed.

let name = "John";        // String  
let age = 30; // Number
let isOnline = true; // Boolean
let score = null; // Null
let x; // Undefined
let user = {name: "Ali"}; // Object
let colors = ["red", "blue"]; // Array


3️⃣ Type Checking

console.log(typeof age);      // "number"  
console.log(typeof name); // "string"


4️⃣ Operators in JavaScript

Arithmetic Operators:
let x = 10, y = 3;
console.log(x + y); // 13
console.log(x % y); // 1
console.log(x ** y); // 1000


Assignment Operators:
x += 5; // same as x = x + 5  
x *= 2;


Comparison Operators:
console.log(x > y);     // true  
console.log(x === 10); // true
console.log(x !== y); // true


Logical Operators:
let a = true, b = false;
console.log(a && b); // false
console.log(a || b); // true
console.log(!a); // false


✅ Practice Task:
1. Create 3 variables: name, age, isStudent
2. Print them using console.log()
3. Use arithmetic operators to perform basic math
4. Try typeof on each variable

💬 Tap ❤️ for more!
  • ❤ 25
  • 👍 1
  • 👏 1
More from @javascript_courses
  1. Oct 9, 2026🇮🇳 𝗚𝗢𝗩𝗘𝗥𝗡𝗠𝗘𝗡𝗧 𝗢𝗙 𝗜𝗡𝗗𝗜𝗔 — 𝗔𝗜𝗖𝗧𝗘 𝗜𝗡𝗧𝗘𝗥𝗡𝗦𝗛𝗜𝗣𝗦 𝟮𝟬𝟮𝟲 🚀…
  2. Oct 8, 2026🎓 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘄𝗶𝘁𝗵 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀! 🚀🔥 Upgr…
  3. Oct 7, 2026🚀𝗣𝗮𝘆 𝗔𝗳𝘁𝗲𝗿 𝗣𝗹𝗮𝗰𝗲𝗺𝗲𝗻𝘁 𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 | 𝗕𝗲𝗰𝗼𝗺𝗲 𝗮 𝗙𝘂𝗹𝗹𝘀𝘁𝗮𝗰…
  4. Oct 7, 2026𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝗼𝘄𝗲𝗿 𝗕𝗜 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘! 🔥 Learn Power BI through these FREE learnin…
  5. Oct 4, 2026DSA Handwritten Notes
  6. Sep 28, 2026To learn web design and development from basic to advanced levels, you can follow these st…
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 →