Skip to main content

Featured

🧮 Day 18 — Mini Project: Interactive To-Do List App

🧮 Day 18 — Mini Project: Interactive To-Do List App Welcome to Day 18 🎉 It’s time to apply everything you’ve learned! In this mini project, you’ll build a **To-Do List App** that lets users add, remove, and mark tasks as complete — all powered by DOM manipulation and JavaScript logic. 🧩 1️⃣ Project Overview Features you’ll build: Add tasks dynamically Mark tasks as complete Delete tasks Store tasks temporarily ⚙️ 2️⃣ HTML Structure <div class="todo-container"> <h2>My To-Do List</h2> <input id="taskInput" type="text" placeholder="Enter a task..."> <button id="addBtn">Add</button> <ul id="taskList"></ul> </div> 🎨 3️⃣ Basic CSS (Optional) .todo-container { width: 400px; margin: 30px auto; text-align: center; background: #e8f5e9; padding: 20px; border-radius: 12px; } li { list-style: none; background: white; margin: 8px 0;...

⚡ Day 12 — Arrow Functions & ES6 Features

⚡ Day 12 — Arrow Functions & ES6 Features

Hi Guys, Welcome to Day 12 🌟 JavaScript has evolved a lot — and **ES6 (ECMAScript 2015)** introduced modern features that make coding cleaner and easier. Today, you’ll learn about **arrow functions**, **let/const**, **template literals**, **destructuring**, and more.

🧩 1️⃣ Arrow Functions

Arrow functions are a shorter and more elegant way to write functions.

// Normal function
function greet(name) {
  return "Hello " + name;
}

// Arrow function
const greetArrow = (name) => "Hello " + name;

console.log(greetArrow("Rahul"));

🔸 2️⃣ let & const

let and const are block-scoped variables (better than var).

let age = 23;
const country = "India";

age = 24;
// country = "USA"; ❌ Error - const cannot be changed

🔹 3️⃣ Template Literals

Use backticks (`) to embed variables directly.

let name = "Rahul";
let msg = `Hello ${name}, welcome to JavaScript!`;
console.log(msg);

🔹 4️⃣ Object Destructuring

let user = {name: "Rahul", age: 23, city: "Hyderabad"};
let {name, age, city} = user;
console.log(name, age, city);

🔹 5️⃣ Spread & Rest Operators

let arr1 = [1, 2, 3];
let arr2 = [...arr1, 4, 5];
console.log(arr2);

function sum(...numbers) {
  return numbers.reduce((a, b) => a + b);
}
console.log(sum(10, 20, 30));

🎯 Summary

Modern JavaScript (ES6+) helps you write cleaner, faster, and more efficient code. Next, we’ll move on to **Iterators, for...of, and for...in loops** — mastering data traversal in a modern way!

Comments