Description
An AI agent will hand you JavaScript that runs, passes a lint check, and is quietly wrong. It compares a form value with == and lets a string sneak past a number check. It reads a stale variable out of a closure and shows yesterday’s total. It mutates an array that two other views are pointing at, so editing one row changes three. It adds prices as floating-point dollars and bills the customer a cent off. It awaits inside a loop, so ten requests that could have flown together stand in a queue. It swallows a rejected promise and the error disappears with the money attached to it. The browser paints something, so the code looks done. JavaScript runs almost anything, because running proves the syntax parsed, not that the equality, the timing, the mutation, or the failure path are right. Syntax tutorials will not save you here, because you are not the one typing the code. What you lack is the reviewer’s model of how the language actually behaves, so you can read a diff of agent-written JavaScript and know whether to ship it or send it back.
This book trains you to be the reviewer of vibe-coded JavaScript, not to memorize the syntax. It starts from a premise most JavaScript books skip: the agent writes the code, and your edge is understanding what that code truly does when the browser runs it, so you can review it with judgment a linter does not have. You will learn what a value really is and where coercion turns one type into another behind your back, why two things that look equal are not, how scope and closures capture variables and how that capture goes stale, what this points at and when it silently rebinds, how objects share references so one change ripples into three, why the event loop runs your code in an order you did not write, how promises and async/await hide a rejected path, and where a browser tab leaks memory until it crawls. You will learn all of it the way a reviewer needs it, by reading real code the agent would generate for Ledger, a small browser expense tracker we return to in every chapter, and deciding what is correct, what is plausible-but-dangerous, and what to push back on. The progression moves from a single value and how it gets compared, to a function and what it captured, to the whole async runtime and where it will break under real data and real users. There is almost no syntax drill here, and a great deal about behavior, timing, failure modes, and the specific ways an agent’s JavaScript goes wrong. For engineers who are going to vibe-code in JavaScript either way and want to be the one who catches what the model missed.
Who this book is for
This book is for: engineers who have decided to let an AI agent write their JavaScript (vibe-coding) and now own the part the agent cannot, which is judging whether the code it produced is correct, fast, and safe to run in a real browser, and who refuse to spend months grinding syntax tutorials to reach that judgment.
Everything inside
- Chapter 1: The day the agent writes all your JavaScript
- Chapter 2: The total was wrong and nothing threw
- Chapter 3: Why the button always shows the last value
- Chapter 4: The method that forgot which object it belonged to
- Chapter 5: The field you set that was never really there
- Chapter 6: You edited one row and three of them changed
- Chapter 7: The function that remembers the last call
- Chapter 8: Why your code runs in an order you did not write
- Chapter 9: The error that vanished and took the money with it
- Chapter 10: The loop that made ten requests wait in line
- Chapter 11: It broke in production and the log said nothing
- Chapter 12: Why importing one file ran code you never called
- Chapter 13: The list that got slower every time you clicked
- Chapter 14: The tab that was still leaking at 3am


