browse/

29 results
tools/regular-expressions-describe-the-shape-of-text-and-watch-a-pattern-fin.md Regular expressions: describe the shape of text and watch a pattern find it A regular expression describes the shape of text instead of spelling it out, so one short pattern can find every phone number or check that… 4 min read · 14 Nov languages/javascript-closures-how-a-function-remembers-a-variable-after-the-func.md JavaScript closures: how a function remembers a variable after the function that made it has finished A function in JavaScript can still use a variable long after the function that created it has finished. That is called a closure, and you… 5 min read · 3 Nov mobile/screen-readers-how-a-phone-decides-what-to-say-about-a-button-it-can-t.md Screen readers: how a phone decides what to say about a button it can't see A phone screen reader like VoiceOver or TalkBack can't see your pictures. It reads a hidden list of items, each with a role, a label and a… 4 min read · 3 Nov software-design/feature-flags-how-to-ship-code-switched-off-and-turn-it-on-for-10-of-u.md Feature flags: how to ship code switched off and turn it on for 10% of users A feature flag is a yes/no setting your code checks before choosing between old and new behaviour, so you can ship code switched off and… 5 min read · 2 Nov mobile/tap-scroll-or-long-press-how-a-phone-decides-what-your-finger-meant.md Tap, scroll or long press: how a phone decides what your finger meant A touchscreen only reports a finger going down, moving, and coming up. So how does your phone tell a tap from a scroll from a long press?… 5 min read · 31 Oct web/cors-why-a-browser-blocks-a-request-your-server-happily-answered.md CORS: why a browser blocks a request your server happily answered You call your own API from a web page and the browser says blocked by CORS policy, even though the address works in a new tab. The server… 5 min read · 29 Oct security/cross-site-scripting-how-a-comment-box-can-run-someone-else-s-code.md Cross-site scripting: how a comment box can run someone else's code A comment box looks harmless until someone types a tiny program instead of a comment. This article explains cross-site scripting, or XSS… 5 min read · 28 Oct web/flexbox-how-a-row-of-boxes-decides-who-gets-the-leftover-space.md Flexbox: how a row of boxes decides who gets the leftover space Put three boxes in a row and the browser decides, by a short fixed recipe, who gets the extra room and who gives some up. Learn the three… 6 min read · 26 Oct software-design/refactoring-how-to-tidy-working-code-without-breaking-it.md Refactoring: how to tidy working code without breaking it Refactoring means changing how code is built on the inside without changing what it does. It sounds risky, but there is a simple routine… 6 min read · 24 Oct computers/the-call-stack-why-a-function-that-never-stops-crashes-your-program.md The call stack: why a function that never stops crashes your program Every time a function is called, the computer puts a small block of memory called a frame on top of a call stack, and removes it when the… 5 min read · 23 Oct languages/javascript-s-event-loop-why-settimeout-0-runs-after-the-code-below-it.md JavaScript's event loop: why setTimeout(…, 0) runs after the code below it Why does `setTimeout(fn, 0)` run after the lines below it, and why does a promise callback beat it? JavaScript has one worker and two… 5 min read · 22 Oct software-design/unit-tests-why-four-passing-tests-don-t-prove-a-function-works.md Unit tests: why four passing tests don't prove a function works Your function gave the right answer four times. Is it correct? Not necessarily: passing tests only show the bug isn't where you looked… 4 min read · 21 Oct