Complete JavaScript notes covering variables, functions, DOM, ES6+, and async JS. Clear examples for beginners and interview prep. Start learning now!
Written by Kartik Rai
Working at Adobe · Founder, Underrated Coder

Learning JavaScript can feel overwhelming when you're jumping between scattered tutorials, GitHub repos, and video courses. This guide brings together clear, structured JavaScript notes covering everything from variables to async programming, so you have one reliable reference to study, revise, and return to before interviews.
JavaScript notes are a structured summary of the language's core concepts — variables, data types, functions, DOM manipulation, ES6+ features, and asynchronous programming — organized for quick learning and revision. They're most useful for students preparing for exams, self-taught developers building a foundation, and job seekers revising before technical interviews.
Most people learning JavaScript hit the same wall: too much information, no clear structure. A GitHub repo full of code snippets isn't the same as notes you can actually revise from. Well-organized notes give you three things a random tutorial doesn't — a logical progression, quick lookup for syntax you forget, and a revision tool you can use again before interviews or projects.
JavaScript gives you three ways to declare a variable, and knowing when to use each one matters for writing clean code.
var — reassignable, function-scoped (not block-scoped), best avoided in new projects since it's a legacy featurelet — reassignable and block-scoped, ideal for values that change, like counters or loop variablesconst — block-scoped but cannot be reassigned, best for values that stay fixed, like config values or constantsjavascript
let score = 10; score = 15; // allowed const name = "Riya"; name = "Aman"; // throws an error
JavaScript has two categories of data types:
String, Number, Boolean, undefined, null, Symbol, BigIntObject, Array, FunctionA quick way to check any value's type is the typeof operator — typeof "hello" returns "string", and typeof 42 returns "number".
Arithmetic (+, -, *, /, %), comparison (==, ===, !=, !==), and logical (&&, ||, !) operators form the backbone of most JavaScript logic. The strict equality operator === is worth memorizing early — it compares both value and type, avoiding the quirky type coercion that == allows.
Control flow structures decide how your code branches and repeats.
javascript
// if-else if (score >= 90) { console.log("Grade A"); } else if (score >= 75) { console.log("Grade B"); } else { console.log("Needs improvement"); } // for loop for (let i = 0; i < 5; i++) { console.log(i); } // while loop let count = 0; while (count < 3) { console.log(count); count++; }
The switch statement is useful when you're checking one variable against many possible fixed values — it reads cleaner than a long chain of else if blocks.
Functions are how you package reusable logic. JavaScript supports several syntaxes worth having in your notes.
javascript
// Function declaration function greet(name) { return `Hello, ${name}!`; } // Function expression const greet2 = function(name) { return `Hi, ${name}!`; }; // Arrow function const greet3 = (name) => `Hey, ${name}!`;
Arrow functions don't have their own this binding — they inherit this from the surrounding scope. This single detail causes more beginner confusion than almost anything else in JavaScript, so it's worth a dedicated note entry when you're revising.
Arrays store ordered collections of data. The methods you'll use constantly:
.map() — transforms each item, returns a new array.filter() — keeps items matching a condition.reduce() — collapses an array into a single value.forEach() — runs a function on each item without returning anythingjavascript
const numbers = [1, 2, 3, 4, 5]; const doubled = numbers.map(n => n * 2); // [2, 4, 6, 8, 10] const evens = numbers.filter(n => n % 2 === 0); // [2, 4] const sum = numbers.reduce((acc, n) => acc + n, 0); // 15
Objects store key-value pairs and are how you model real-world entities in code.
javascript
const student = { name: "Priya", age: 21, courses: ["JavaScript", "React"] }; console.log(student.name); // dot notation console.log(student["age"]); // bracket notation
The Document Object Model (DOM) is how JavaScript interacts with a webpage's structure.
javascript
const heading = document.querySelector("h1"); heading.textContent = "Updated Heading"; heading.style.color = "blue"; const button = document.getElementById("submitBtn"); button.addEventListener("click", () => { alert("Button clicked!"); });
querySelector and querySelectorAll are the modern standard for selecting elements — they accept any valid CSS selector, making them more flexible than older methods like getElementById.
Modern JavaScript (ES6 and later) introduced syntax that makes code shorter and easier to read. These show up constantly in real codebases and interview questions:
`Hello, ${name}` instead of string concatenationconst { name, age } = student;const newArr = [...oldArr, newItem];function greet(name = "Guest") { }student?.address?.city avoids errors when a property might not existAsync code is where most beginners get stuck, so it deserves its own dedicated section in any set of notes.
javascript
// Promise fetch("https://api.example.com/data") .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error(error)); // Async/await (cleaner syntax for the same thing) async function getData() { try { const response = await fetch("https://api.example.com/data"); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } }
async/await is built on top of Promises — it doesn't replace them, it just makes asynchronous code read more like synchronous code, which is why most modern codebases prefer it over chained .then() calls.
JSON (JavaScript Object Notation) is the standard format for exchanging data between a client and server.
javascript
const obj = { name: "Aman", age: 25 }; const jsonString = JSON.stringify(obj); // object → JSON string const parsedObj = JSON.parse(jsonString); // JSON string → object
Every API you'll work with as a JavaScript developer sends and receives data in this format, which makes JSON.stringify() and JSON.parse() two of the most-used methods in real projects.
These JavaScript notes cover the core concepts you'll use in almost every project — variables, functions, arrays, objects, the DOM, ES6+ syntax, and async programming. Bookmark this as your quick-reference guide, and pair it with hands-on coding practice to make the concepts stick.
The basics include variables (var, let, const), data types, operators, control flow (if-else, loops), functions, and arrays/objects. Once these are solid, DOM manipulation and events are the natural next step.
var is function-scoped and can be redeclared, let is block-scoped and reassignable, and const is block-scoped but cannot be reassigned after declaration. Most modern JavaScript code avoids var entirely in favor of let and const.
With consistent daily practice, most learners can grasp core JavaScript fundamentals in 4-6 weeks. Reaching comfort with async programming and DOM manipulation typically takes a few months of hands-on project work.
These notes cover the core concepts interviewers commonly test, but interview prep should also include practicing coding problems and reviewing common patterns like array manipulation and closures. Notes work best as a quick-reference alongside active problem-solving practice.
After the fundamentals, most learners move on to a framework like React or Vue, along with deeper topics like closures, the event loop, and error handling. Building small projects is the fastest way to cement these concepts.
Pair this article with free tools and live classes on the platform:

Compare free AI coding tools for BTech students: Cursor, Copilot, ChatGPT, Gemini, Ollama. Vibe coding tips, prompts, and a weekly routine for placements.

Learn how college students can earn ₹1 Lakh in 7 days by picking a validated problem from Razorpay Fix My Itch, designing architecture in Emergent AI, building with Google Antigravity or Claude Code, and distributing to paying users.

Explore coding notes for Java, Python, JavaScript, C++, and DSA. Learn programming concepts easily with beginner-friendly notes.
Read more on the blog or unlock Pro for live classes, mentorship, and full placement prep.
Complete JavaScript notes covering variables, functions, DOM, ES6+, and async JS. Clear examples for beginners and interview prep. Start learning now!
Written by Kartik Rai
Working at Adobe · Founder, Underrated Coder

Learning JavaScript can feel overwhelming when you're jumping between scattered tutorials, GitHub repos, and video courses. This guide brings together clear, structured JavaScript notes covering everything from variables to async programming, so you have one reliable reference to study, revise, and return to before interviews.
JavaScript notes are a structured summary of the language's core concepts — variables, data types, functions, DOM manipulation, ES6+ features, and asynchronous programming — organized for quick learning and revision. They're most useful for students preparing for exams, self-taught developers building a foundation, and job seekers revising before technical interviews.
Most people learning JavaScript hit the same wall: too much information, no clear structure. A GitHub repo full of code snippets isn't the same as notes you can actually revise from. Well-organized notes give you three things a random tutorial doesn't — a logical progression, quick lookup for syntax you forget, and a revision tool you can use again before interviews or projects.
JavaScript gives you three ways to declare a variable, and knowing when to use each one matters for writing clean code.
var — reassignable, function-scoped (not block-scoped), best avoided in new projects since it's a legacy featurelet — reassignable and block-scoped, ideal for values that change, like counters or loop variablesconst — block-scoped but cannot be reassigned, best for values that stay fixed, like config values or constantsjavascript
let score = 10; score = 15; // allowed const name = "Riya"; name = "Aman"; // throws an error
JavaScript has two categories of data types:
String, Number, Boolean, undefined, null, Symbol, BigIntObject, Array, FunctionA quick way to check any value's type is the typeof operator — typeof "hello" returns "string", and typeof 42 returns "number".
Arithmetic (+, -, *, /, %), comparison (==, ===, !=, !==), and logical (&&, ||, !) operators form the backbone of most JavaScript logic. The strict equality operator === is worth memorizing early — it compares both value and type, avoiding the quirky type coercion that == allows.
Control flow structures decide how your code branches and repeats.
javascript
// if-else if (score >= 90) { console.log("Grade A"); } else if (score >= 75) { console.log("Grade B"); } else { console.log("Needs improvement"); } // for loop for (let i = 0; i < 5; i++) { console.log(i); } // while loop let count = 0; while (count < 3) { console.log(count); count++; }
The switch statement is useful when you're checking one variable against many possible fixed values — it reads cleaner than a long chain of else if blocks.
Functions are how you package reusable logic. JavaScript supports several syntaxes worth having in your notes.
javascript
// Function declaration function greet(name) { return `Hello, ${name}!`; } // Function expression const greet2 = function(name) { return `Hi, ${name}!`; }; // Arrow function const greet3 = (name) => `Hey, ${name}!`;
Arrow functions don't have their own this binding — they inherit this from the surrounding scope. This single detail causes more beginner confusion than almost anything else in JavaScript, so it's worth a dedicated note entry when you're revising.
Arrays store ordered collections of data. The methods you'll use constantly:
.map() — transforms each item, returns a new array.filter() — keeps items matching a condition.reduce() — collapses an array into a single value.forEach() — runs a function on each item without returning anythingjavascript
const numbers = [1, 2, 3, 4, 5]; const doubled = numbers.map(n => n * 2); // [2, 4, 6, 8, 10] const evens = numbers.filter(n => n % 2 === 0); // [2, 4] const sum = numbers.reduce((acc, n) => acc + n, 0); // 15
Objects store key-value pairs and are how you model real-world entities in code.
javascript
const student = { name: "Priya", age: 21, courses: ["JavaScript", "React"] }; console.log(student.name); // dot notation console.log(student["age"]); // bracket notation
The Document Object Model (DOM) is how JavaScript interacts with a webpage's structure.
javascript
const heading = document.querySelector("h1"); heading.textContent = "Updated Heading"; heading.style.color = "blue"; const button = document.getElementById("submitBtn"); button.addEventListener("click", () => { alert("Button clicked!"); });
querySelector and querySelectorAll are the modern standard for selecting elements — they accept any valid CSS selector, making them more flexible than older methods like getElementById.
Modern JavaScript (ES6 and later) introduced syntax that makes code shorter and easier to read. These show up constantly in real codebases and interview questions:
`Hello, ${name}` instead of string concatenationconst { name, age } = student;const newArr = [...oldArr, newItem];function greet(name = "Guest") { }student?.address?.city avoids errors when a property might not existAsync code is where most beginners get stuck, so it deserves its own dedicated section in any set of notes.
javascript
// Promise fetch("https://api.example.com/data") .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error(error)); // Async/await (cleaner syntax for the same thing) async function getData() { try { const response = await fetch("https://api.example.com/data"); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } }
async/await is built on top of Promises — it doesn't replace them, it just makes asynchronous code read more like synchronous code, which is why most modern codebases prefer it over chained .then() calls.
JSON (JavaScript Object Notation) is the standard format for exchanging data between a client and server.
javascript
const obj = { name: "Aman", age: 25 }; const jsonString = JSON.stringify(obj); // object → JSON string const parsedObj = JSON.parse(jsonString); // JSON string → object
Every API you'll work with as a JavaScript developer sends and receives data in this format, which makes JSON.stringify() and JSON.parse() two of the most-used methods in real projects.
These JavaScript notes cover the core concepts you'll use in almost every project — variables, functions, arrays, objects, the DOM, ES6+ syntax, and async programming. Bookmark this as your quick-reference guide, and pair it with hands-on coding practice to make the concepts stick.
The basics include variables (var, let, const), data types, operators, control flow (if-else, loops), functions, and arrays/objects. Once these are solid, DOM manipulation and events are the natural next step.
var is function-scoped and can be redeclared, let is block-scoped and reassignable, and const is block-scoped but cannot be reassigned after declaration. Most modern JavaScript code avoids var entirely in favor of let and const.
With consistent daily practice, most learners can grasp core JavaScript fundamentals in 4-6 weeks. Reaching comfort with async programming and DOM manipulation typically takes a few months of hands-on project work.
These notes cover the core concepts interviewers commonly test, but interview prep should also include practicing coding problems and reviewing common patterns like array manipulation and closures. Notes work best as a quick-reference alongside active problem-solving practice.
After the fundamentals, most learners move on to a framework like React or Vue, along with deeper topics like closures, the event loop, and error handling. Building small projects is the fastest way to cement these concepts.
Pair this article with free tools and live classes on the platform:

Compare free AI coding tools for BTech students: Cursor, Copilot, ChatGPT, Gemini, Ollama. Vibe coding tips, prompts, and a weekly routine for placements.

Learn how college students can earn ₹1 Lakh in 7 days by picking a validated problem from Razorpay Fix My Itch, designing architecture in Emergent AI, building with Google Antigravity or Claude Code, and distributing to paying users.

Explore coding notes for Java, Python, JavaScript, C++, and DSA. Learn programming concepts easily with beginner-friendly notes.
Read more on the blog or unlock Pro for live classes, mentorship, and full placement prep.