Key takeaways
- Use
constby default,letwhen the value changes, and avoidvar; always compare with===. map,filter,reduceandfindare explained with one array and their outputs, side by side.- The DOM sections show how to select, change, create and remove elements, and why
textContentis safer thaninnerHTML. - The event loop diagram explains why a promise callback runs before a
setTimeoutof 0 ms. fetchdoes not fail on a 404, so the notes always checkres.okbefore reading the JSON.
About these JavaScript notes
This page offers Uncodemy's JavaScript notes as a free PDF. JavaScript is the programming language that makes web pages interactive: button clicks, form checks, menus and live data. It runs in every browser and also on servers through Node.js. The notes explain each idea in simple words and back it with a short, commented code example that shows the output, so you can run it in the browser console and see the same result.
Please note: these are original Uncodemy learning notes, not the official language specification. JavaScript gets new features every year, so check MDN Web Docs when you need every option of a method.
What's inside the JavaScript notes
The PDF has 17 pages arranged in 14 numbered sections. Here is what each section covers.
1. Start with JavaScript
What JavaScript does next to HTML and CSS, adding a script with defer, a first app.js with console.log and a click listener, and using the browser Console (F12) to see output and errors.
2. Variables and data types
let, const and var compared on scope and reassignment, the data types (number, string, boolean, undefined, null, object, bigint and symbol), typeof, template literals, string methods, type conversion, strict equality and the list of falsy values.
3. Operators and control flow
Arithmetic, comparison, logical, assignment and nullish operators (?? and ?.), if and else if, the ternary operator, switch, and the for, while, for...of and for...in loops, with break, continue and return.
4. Functions
Function declarations, function expressions and arrow functions, default parameters, rest parameters, spread, callbacks, scope and closures (with a private counter example), and how this works in arrow functions.
5. Arrays and objects
A table of array methods (push, pop, shift, unshift, map, filter, reduce, find, includes, sort, slice and splice), objects with methods, dot and bracket access, Object.keys and Object.entries, and JSON with JSON.stringify and JSON.parse.
6. ES6 features
A table of modern features with an example and a reason for each, then array and object destructuring, spread copies, optional chaining, classes with inheritance and a private field, modules with import and export, and Map and Set.
7. The DOM
The page as a tree of nodes (with a diagram), getElementById, querySelector and querySelectorAll, changing text, styles, classes and attributes, creating and removing elements, and the XSS risk of putting user text into innerHTML.
8. Events
A table of common events (click, input, change, submit, keydown, mouseover, DOMContentLoaded, scroll and resize), addEventListener with event.target, preventDefault on forms, event bubbling, event delegation with closest(), and a counter mini project.
9. Asynchronous JavaScript
Why single-threaded JavaScript needs async code (the restaurant waiter idea), setTimeout, callback hell, and the event loop with the call stack, Web APIs and the microtask and task queues, plus an output-order puzzle.
10. Promises
The three promise states with a diagram, creating a promise with resolve and reject, chaining then, catch and finally, and a table of Promise.all, allSettled, race and any.
11. Async / await
The same promise flow written with async and await inside try, catch and finally, and why two awaits in a row are slower than Promise.all.
12. Fetch API and storage
A GET request with error handling and res.ok, a POST request with JSON headers and body, showing the result on the page, and saving data in localStorage with JSON.
13. Errors and debugging
ReferenceError, TypeError, SyntaxError and RangeError with common causes, try, catch, finally and throw, and debugging with console.table, the debugger statement and breakpoints in the Sources tab.
14. Projects and practice
Seven projects (counter and colour changer, to-do list, form validator, quiz app, weather or user app, stopwatch, and image gallery with a modal), a common mistakes table and 10 practice questions.
How to use these notes to learn JavaScript
JavaScript makes sense only when you run it. Open the browser console or a code editor next to the PDF.
- Run every example and check that your output matches the comment in the notes.
- Change the inputs and predict the output before you press Enter.
- For async code, write the output order on paper first, then run it to check.
- After each section, build a tiny page that uses it, for example a click counter after the events section.
A simple three-pass method works well. In the first pass, read one section and run its examples. In the second pass, close the notes and write the same examples from memory, then compare and fix. In the third pass, a day or two later, answer the related practice questions aloud as if in an interview and build one project from section 14.
Syntax to remember
constfor values that do not change,letfor values that do;===for comparison.- Falsy values:
false,0,"",null,undefinedandNaN. arr.map(fn)andarr.filter(fn)return new arrays;arr.reduce((total, n) => total + n, 0)returns one value.- Sort numbers with
arr.sort((a, b) => a - b). const { name, age = 18 } = obj;for destructuring with a default value.user?.address?.city ?? "No city"to read missing data safely.awaitonly inside anasyncfunction, wrapped intryandcatch.
Common mistakes beginners make
- Using
==and getting surprises from type conversion. - Running a script before the HTML exists; use
deferor put the script at the end of the body. - Forgetting
await, so the variable holds a pending promise instead of the data. - Not checking
res.okafterfetch, so a 404 page is treated as success. - Thinking a
constarray cannot change;conststops reassignment, notpush.
Interview focus: JavaScript topics asked most
JavaScript is the core of front-end and full stack interviews. Expect both theory questions and short output-prediction or coding tasks.
var,letandconst, hoisting and scope.- Closures,
thisand arrow functions. map,filterandreduce, destructuring, spread and rest.- The DOM, event bubbling and event delegation.
- The event loop, promises and async/await.
Typical questions
- What is the difference between var, let and const?
- What is the difference between == and ===? What are falsy values?
- What is a closure? Give a small example.
- Explain map, filter and reduce with examples.
- What is event bubbling and event delegation?
- Explain the event loop. Why does a promise run before setTimeout?
- What are the three states of a promise? How do you handle errors?
- Write an async function that fetches data and handles errors.
Answer with a one-line definition, a three or four line code example and the output. Interviewers often change one line of your example and ask what happens, so make sure you understand each line.
A 7-day plan for JavaScript
- Day 1: Start with JavaScript, variables and data types.
- Day 2: Operators and control flow, functions (including closures).
- Day 3: Arrays and objects, ES6 features. Solve five small array problems with map, filter and reduce.
- Day 4: The DOM, events. Build the counter and a to-do list with event delegation.
- Day 5: Asynchronous JavaScript, promises, async/await. Predict the output of the event loop examples on paper.
- Day 6: Fetch API and storage, errors and debugging. Build the weather or user app with loading and error states.
- Day 7: answer the 10 practice questions from memory and build one more project from section 14, such as the quiz app.
Keep building one small project every week. Open DevTools while you code and read every error message; it tells you the line number.
Who these notes are for
- Students who know basic HTML and CSS and want to add interaction.
- B.Tech, BCA and MCA students with a web technologies or front-end lab.
- Learners preparing for React, Node.js or a full stack course.
- Freshers revising JavaScript before front-end, full stack or automation testing interviews.
If you are new to web pages, start with the HTML CSS Notes PDF first. After JavaScript, the React JS Notes PDF is the natural next step.
Download JavaScript Notes PDF
JavaScript Notes PDF: ES6, DOM and Async
The PDF carries the same content as this page in a clean, print-ready layout, so you can read it offline and keep it for revision.
17 pages · 165 KB · PDF · Updated 5 Nov 2026