JavaScript Fundamentals
beginnerWhat You'll Learn
JavaScript is the programming language of the web, enabling interactive and dynamic experiences in browsers. It runs on the client side to manipulate the DOM, handle user events, and communicate with servers asynchronously. With the rise of Node.js, JavaScript now also powers servers, CLIs, and desktop applications.
Execution environments:
- Browser — JavaScript runs inside an HTML page via
<script>tags, with access towindow,document, and Web APIs - Node.js — server-side runtime built on Chrome's V8 engine, providing access to the file system, network, and process management without browser APIs
Core concepts include variables (let, const, var), data types (string, number, boolean, object, undefined, null), functions, and control flow. JavaScript is dynamically typed, meaning variables can hold any type without explicit declaration.
Modern JavaScript (ES6+) brought block-scoped variables, arrow functions, template literals, destructuring, modules, and promises — making the language more expressive and easier to work with for large-scale applications.
Why this matters
JavaScript is the engine that makes the web interactive. From simple form validation to complex single-page applications, understanding where and how JavaScript runs is the first step to becoming a full-stack developer.
What's next
In the next lessons, you'll dive deeper into each topic with hands-on examples and exercises.
Exercises
Environment Check
Write JavaScript code that prints the word 'browser' if running in a browser environment (check for window object) or 'node' if running in Node.js (check for process object). Simply print typeof window and typeof process.
Starter Code:
// Check which environment this code runs inExpected Output:
object\nundefined