7 Aug 2026, 04:25 UTC10 views4 reactionsread 13 August 2026 Variables & Data Types (Deep Dive)
Declaring Variables
JavaScript has three ways to declare a variable:
let score = 10; // block-scoped, reassignable
const name = "Alex"; // block-scoped, NOT reassignable
var old = "avoid"; // function-scoped, legacy — avoid
Why avoid var? It's scoped to the whole function, not the block, which causes bugs:
if (true) {
var x = 5;
}
console.log(x); // 5 — leaked outside th…
❤2👍2
7 Aug 2026, 04:21 UTC9 viewsread 13 August 2026 Sticker
Sticker, posted without a caption
7 Aug 2026, 04:19 UTC11 viewsread 13 August 2026 Loops
for (let i = 0; i < 5; i++) {
console.log(i);
}
let i = 0;
while (i < 5) {
console.log(i);
i++;
}
for (let fruit of fruits) {
console.log(fruit);
}
7 Aug 2026, 04:19 UTC10 viewsread 13 August 2026 Objects
let person = {
name: "Alex",
age: 25,
greet() {
console.log("Hi, I'm " + this.name);
}
};
console.log(person.name); // dot notation
console.log(person["age"]); // bracket notation
person.greet();
7 Aug 2026, 04:19 UTC10 viewsread 13 August 2026 Arrays
let fruits = ["apple", "banana", "cherry"];
fruits.push("date"); // add to end
fruits.pop(); // remove from end
fruits[0]; // "apple"
fruits.length; // 4
fruits.forEach(f => console.log(f));
let upper = fruits.map(f => f.toUpperCase());
let long = fruits.filter(f => f.length > 5);
7 Aug 2026, 04:18 UTC10 viewsread 13 August 2026 Functions
// Regular function
function greet(name) {
return "Hello, " + name;
}
// Arrow function (modern, common)
const greet2 = (name) => {
return "Hello, " + name;
};
// Short arrow function
const greet3 = name => `Hello, ${name}`;
console.log(greet("Alex")); // Hello, Alex
7 Aug 2026, 04:17 UTC10 viewsread 13 August 2026 Conditionals
let age = 18;
if (age >= 18) {
console.log("Adult");
} else if (age >= 13) {
console.log("Teenager");
} else {
console.log("Child");
}
7 Aug 2026, 04:17 UTC10 viewsread 13 August 2026 Operators
5 + 3 // 8
10 - 4 // 6
3 * 4 // 12
10 / 2 // 5
10 % 3 // 1 (remainder)
5 === 5 // true (strict equality — use this)
5 == "5" // true (loose equality — avoid this)
5 !== 3 // true
true && false // AND
true || false // OR
!true // NOT
7 Aug 2026, 04:16 UTC11 viewsread 13 August 2026 Data Types
let str = "hello"; // string
let num = 42; // number
let bool = true; // boolean
let arr = [1, 2, 3]; // array
let obj = { name: "Alex", age: 25 }; // object
let nothing = null; // intentional empty value
let notDefined; // undefined
7 Aug 2026, 04:15 UTC11 viewsread 13 August 2026 Variables
let name = "Alex"; // can be reassigned
const age = 25; // cannot be reassigned
var oldWay = "avoid"; // outdated, avoid using
7 Aug 2026, 04:13 UTC11 viewsread 13 August 2026 JavaScript is a programming language that runs in web browsers (and on servers via Node.js). It's used to make web pages interactive, handling clicks, updating content, validating forms, fetching data, and much more.
Where to Write JavaScript ?
» Easiest way to start: open your browser's DevTools console (F12 or right-click → Inspect → Console) and type code directly.
» In an HTML file
28 Jul 2026, 04:15 UTC28 views3 reactionsread 13 August 2026 JavaScript tutorial ??
❤2👍1
Showing the 12 most recent of 17 posts we hold for @RajCodeDump. View and reaction counts are the latest single reading for each post, not a live figure, and a recent post is still accumulating both. A view count marked ≈ was rounded by Telegram before we ever saw it — t.me prints views in full below 1,000 and to three significant figures above, so ≈1,200,000 means somewhere between 1,150,000 and 1,249,999. Unmarked counts are exact. Text is reproduced from the public post preview and truncated for length.