Skip to content

Overview

JavaScript is a high-level, interpreted, dynamically typed programming language. This simply means it is mainly used to build interactive and dynamic web applications, the code is read and run directly (not built into a separate program first), and you do not need to fix the type of your data ahead of time. It runs inside the browser, but it is also widely used on servers, through tools like Node.js.

Unlike languages that need to be compiled first, JavaScript runs directly in the browser with the help of a JavaScript Engine (like V8 in Chrome). This engine reads and runs your code line by line.

JavaScript follows a single-threaded, event-driven architecture, which means it can only do one thing at a time, but it uses something called an event loop to handle tasks that take time (asynchronous operations) without getting stuck.

graph TD A[Call Stack] -->|Executes| B[Function Execution] C[Web APIs] --> D[Callback Queue] D -->|Event Loop| A A --> E[Output] subgraph Async Flow C D end
  • Call Stack -> This is where functions actually run (it works like a stack of plates, last one in is the first one out).
  • Web APIs -> These are extra tools given by the browser, like setTimeout, fetch, and the DOM.
  • Callback Queue -> This is where the async (delayed) callbacks wait their turn.
  • Event Loop -> This moves tasks from the queue into the call stack, but only once the stack is empty.

Dynamic Typing

Variables do not need a fixed type, and their type can even change while the code is running.

First-Class Functions

Functions can be stored in variables, passed into other functions, and even returned out of other functions.

Prototype-Based OOP

Objects inherit features from other objects using something called prototypes, instead of using traditional classes like in some other languages.

Event-Driven

JavaScript reacts to things the user does, like clicking, typing, or getting a response from the network.

graph LR A[Write Code] --> B[JS Engine] B --> C[Parsing] C --> D[Compilation] D --> E[Execution]
  1. Parsing -> This step turns your code into something called an Abstract Syntax Tree (AST), which is basically a structured map of your code.
  2. Compilation -> The code is then turned into a faster form, like bytecode or machine code.
  3. Execution -> Finally, the code actually runs inside the JavaScript engine.

Frontend

Used inside browsers to change what the user sees, using the DOM, events, and other browser tools.

Backend (Node.js)

JavaScript that runs on the server, used for building APIs, talking to databases, and running services.

Frameworks & Libraries

Tools like React, Vue, and Angular help you build bigger, more organized applications.

Tooling

Bundlers (like Webpack and Vite), transpilers (like Babel), and linters (like ESLint) help support your workflow.

  1. Variables & Data Types Understanding var, let, const, and the difference between primitive and reference types.

  2. Operators & Expressions Arithmetic, logical, comparison, and assignment operations.

  3. Control Flow Conditional statements (if, switch) and loops (for, while).

  4. Functions Function declarations, function expressions, arrow functions, and closures.

  5. Objects & Arrays The core data structures that JavaScript is built around.

  6. DOM Manipulation Interacting with HTML elements and changing them dynamically.

  7. Events Handling things the user does, like clicks, typing, and keyboard presses.

  8. Asynchronous JavaScript Callbacks, Promises, and async/await.

  9. Prototypes & Object-Oriented Programming Understanding prototypes, inheritance, and the basics of OOP.

  10. ES6+ Features Modern syntax like destructuring, the spread operator, and modules.

  11. Unexpected JavaScript Behavior A deeper look at surprising things JavaScript does, and how to avoid bugs because of them in real projects.

Here, the code runs one line after another, and each line has to finish before the next one can start (this is called blocking).

graph TD A[Task 1] --> B[Task 2] B --> C[Task 3]

Here, the code does not wait around for slow tasks to finish. It keeps moving (this is called non-blocking), using things like callbacks and promises.

graph TD A[Task 1] --> B[Async Task] B -->|Callback| C[Task 2]
graph TD A[JavaScript Code] --> B[Engine] B --> C[Memory Heap] B --> D[Call Stack]
  • Memory Heap -> This is where objects and variables are actually stored in memory.
  • Call Stack -> This keeps track of which function is currently running.
  • It is essential for web development.
  • It works on both the frontend and the backend.
  • It has a huge ecosystem and a large, active community.
  • It is in very high demand across the industry.