Getting Started
The beginning of a programming book has two jobs. It needs to explain what you are learning, and it needs to help you run code without turning setup into a wall. JavaScript is a good first language because the browser already knows how to run it. You can open DevTools, type one line, and see a result. Later, with Node.js, you can run JavaScript from files on your computer too. This part gives you the starting map. Chapter 1 explains what JavaScript is, how it fits with HTML and CSS, where it runs, and how to think about programming as precise instructions. Chapter 2 sets up the tools you will use for the rest of the book: the browser console, a code editor, a practice folder, Node.js, the terminal, and a simple HTML page. Do not rush these chapters. Setup details can feel less exciting than building an app, but a clean setup saves frustration later. If you can run a console example, run a `.js` file, and connect JavaScript to an HTML page, you have the foundation needed for every later project. By the end of this part, you should be able to explain what JavaScript does, run your first code in the browser, run a JavaScript file with Node.js, and understand the basic workflow of write, save, run, observe, and adjust.
Chapters
Welcome to JavaScript
You are about to learn JavaScript from the beginning. Not from "you should already know what a variable is" beginning. From the real beginning. That matters because programming can feel strange at first. You are not only learning new words. You are learning a new way to describe work. A computer will do exactly what your code says, which is useful and annoying for the same reason: it does not guess what you meant. This chapter gives you the map before you start walking. You will learn what JavaScript is, what programming is, where JavaScript runs, how it fits with HTML and CSS, what kinds of things you will build, and how to practice without getting buried in details too early. That is enough to explain JavaScript in plain language, run your first line of it in the browser console, and picture where the language fits in the websites and apps you already use.
Setting Up Your Environment
Before you write much JavaScript, you need a place to run it and a place to save it. The good news is that the first place is already on your computer if you have a web browser. In this chapter, you will set up the basic working environment for the rest of the book. You will use the browser console for quick experiments, a code editor for writing files, Node.js for running JavaScript outside the browser, and a simple HTML page for running JavaScript inside a web page. When you are done, you will be able to run JavaScript three ways: straight into the browser console, from a `.js` file with Node.js, and inside an HTML page.