Click “Download PDF”, then choose “Save as PDF” as the printer.
Quick revision notes
JavaScript for Beginners
JavaScript basics
Lesson 1How JavaScript runs
- JavaScript runs in every browser’s engine, and on servers with Node.js.
- The console (F12) is the quickest place to experiment.
- Load scripts at the end of the body or with defer.
- Read error messages: they tell you the problem and the line.
Lesson 2Variables and types
- Use const by default, let when the value must change; avoid var.
- Main types: string, number, boolean, undefined, null and object.
- Template literals (backticks) embed values in strings.
- Convert form input with Number(); compare with ===.
Lesson 3Conditions and loops
- if / else if / else runs the first matching branch; combine conditions with &&, || and !.
- Falsy values: false, 0, “”, null, undefined, NaN.
- for loops for counts, while loops for conditions, for…of for lists.
- Avoid infinite loops; use break and continue with care.
Building blocks
Lesson 4Functions
- Functions take parameters, run code and return values.
- Default parameters and arrow functions make code shorter.
- Variables inside a function are local to it (scope).
- Functions are values: callbacks pass behaviour into other functions; keep each function to one job.
Lesson 5Arrays and objects
- Arrays are ordered lists (index from 0); objects hold named properties and methods.
- Arrays of objects are the most common real-world data shape.
- map, filter, find, reduce, sort and forEach handle most list work.
- Destructuring and spread make copies and extract values; JSON converts data to and from text.
Lesson 6The DOM and events
- The DOM is the page as objects; select with querySelector and querySelectorAll.
- Change text with textContent (safer than innerHTML), and styles through CSS classes.
- addEventListener responds to clicks, input, submit and more; preventDefault stops default actions.
- Event delegation handles events for many (and future) child elements with one listener.
Projects
Lesson 7Project: a quiz game
- Keep data (questions) separate from logic (functions).
- Render with createElement and textContent; attach listeners as you create buttons.
- Track state in variables (current question, score) and update the DOM from it.
- Extend with shuffling, timers, restart and data loaded from JSON.
Lesson 8Project: a to-do list
- Keep state in an array; one render function draws the page from it.
- Save with localStorage (as JSON text), guarded by try…catch.
- Use textContent for user text, and event delegation for list actions.
- localStorage is per browser and device; never store sensitive data in it.
Important terms
arguments · arrays · async/await · Avoid side effects · Boolean · Break things on purpose · Build small projects · callback · camelCase · Change things · Comments · Console · DOM · ECMAScript · editing · error message · event delegation · Events · F12 · false · fetch · filters · first · for · for…of · function · infinite loop · JavaScript engine · JSON · JSON file · Keep them short · localStorage · make decisions · methods · Naming rules · Node.js · null · Number · Object · One job per function · parameters · Persistence · remembers them · repeat · Restart · return value · Shuffle · state · State-driven rendering · statements · strict equality · String · text · timer · Type the examples yourself · undefined · variable · while
© 2026 VJ Classes · vjclasses.in