This website requires JavaScript.
⚡️ CLI & Setup
node -v
npm -v
npm init -y
🧩 Variables
let a = 1;
const b = 'text';
var c = true;
📝 Data Types
typeof 42;           // "number"
typeof 'hello';      // "string"
typeof true;         // "boolean"
typeof {};           // "object"
typeof [];           // "object"
typeof null;         // "object"
typeof undefined;    // "undefined"
typeof (() => {});   // "function"
🏗️ Functions
function sum(a, b) {
  return a + b;
}

const add = (a, b) => a + b;
🔄 Control Flow
if (x > 0) { ... }
else if (x < 0) { ... }
else { ... }

for (let i = 0; i < 5; i++) { ... }
while (condition) { ... }
do { ... } while (condition);

switch (value) {
  case 1: ...; break;
  default: ...;
}
📦 Arrays
const arr = [1, 2, 3];
arr.push(4);
arr.pop();
arr.map(x => x * 2);
arr.filter(x => x > 1);
arr.reduce((a, b) => a + b, 0);
arr.includes(2);
arr.indexOf(3);
🗂️ Objects
const obj = { name: 'Alice', age: 30 };
obj.name;
obj['age'];
obj.city = 'NY';
delete obj.age;
Object.keys(obj);
Object.values(obj);
Object.entries(obj);
🛡️ String Methods
const str = 'Hello World';
str.length;
str.toUpperCase();
str.toLowerCase();
str.includes('World');
str.replace('World', 'JS');
str.split(' ');
str.slice(0, 5);
str.trim();
🧪 Event & DOM
document.getElementById('id');
document.querySelector('.class');
document.createElement('div');
element.addEventListener('click', fn);
element.classList.add('active');
element.style.color = 'red';
🔒 ES6+ Features
const [x, y] = [1, 2];                // Array destructuring
const { name, age } = obj;            // Object destructuring
const arr2 = [...arr, 5];             // Spread operator
const obj2 = { ...obj, city: 'LA' };  // Object spread
const greet = (name = 'Guest') => `Hi ${name}`;
🛠️ Misc
console.log('Log');
setTimeout(() => {}, 1000);
setInterval(() => {}, 1000);
JSON.stringify(obj);
JSON.parse('{"a":1}');
HTML
Latex