browse/
29 results
computers/floating-point-why-0-1-0-2-is-not-exactly-0-3.md
Floating point: why 0.1 + 0.2 is not exactly 0.3
Type `0.1 + 0.2` into JavaScript or Python and you get `0.30000000000000004`. It is not a bug, and it is not your mistake. Computers store…
web/the-dom-how-a-browser-turns-html-text-into-a-tree.md
The DOM: how a browser turns HTML text into a tree
A web page starts as plain text, yet a script can add a bullet to it while it is open. How? The browser never works on your text directly…
mobile/offline-sync-what-happens-when-two-phones-edit-the-same-contact.md
Offline sync: what happens when two phones edit the same contact
You edit a contact's phone number on a plane. Your partner fixes the city on a tablet. Both devices are offline, then both reconnect. Which…
software-design/idempotency-why-clicking-pay-twice-should-charge-you-once.md
Idempotency: why clicking Pay twice should charge you once
You tap Pay, the screen shows an error, you tap again, and your card is charged twice. Networks drop messages, so a phone often cannot tell…
software-design/state-machines-why-an-order-can-t-be-delivered-before-it-s-paid.md
State machines: why an order can't be delivered before it's paid
An online order can be in the cart, paid, shipped, delivered or cancelled, but what stops the code from delivering an order nobody paid…
web/event-bubbling-why-clicking-a-button-also-clicks-its-parent.md
Event bubbling: why clicking a button also clicks its parent
You click a button inside a div, and both click handlers run. Why does the parent hear about something that happened to its child? Every…
tools/what-does-1-2-3-mean-in-package-json-version-rules-you-can-try.md
What does ^1.2.3 mean in package.json? Version rules you can try
Open any package.json and you'll see versions like `^4.17.21` or `~1.2.3`. That little symbol is a rule for which updates npm may install…
languages/why-does-5-3-give-53-in-javascript-type-coercion-step-by-step.md
Why does "5" + 3 give "53" in JavaScript? Type coercion, step by step
Why does `"5" + 3` give `"53"` while `"5" - 3` gives `2`? It is not random. JavaScript follows a short recipe called type coercion: it…
software-design/refactoring-tidy-messy-code-without-breaking-it-using-tests-as-a-net.md
Refactoring: tidy messy code without breaking it, using tests as a net
Refactoring means changing how code is written without changing what it does, so the next person (often you) can read it. It sounds risky…
web/what-is-json-edit-it-live-and-see-why-apis-are-so-strict-about-it.md
What is JSON? Edit it live and see why APIs are so strict about it
When an app asks a server for data, the reply has to travel as plain text. JSON is the format most web APIs use: six kinds of value…
mobile/two-phones-one-note-what-happens-when-edits-collide-offline.md
Two phones, one note: what happens when edits collide offline?
Phones lose signal all the time, so good apps keep a local copy of your data and sync with a server later. But what happens when two…
software-design/your-first-unit-test-catch-the-leap-year-bug-a-quick-check-misses.md
Your first unit test: catch the leap-year bug a quick check misses
A unit test is a tiny piece of code that checks another piece of code: you pick an input, write down the answer you expect, and let the…