Tagged posts
Browse by tag
Posts tagged
JavaScript
Diagnosing a common source of race conditions in JS
My thoughts on why expression statements can be a source of bugs—especially in async code—and a proposal for reviving JavaScript's nearly unused void operator.
Becoming an Astro-not
I spent an entire weekend migrating my Eleventy site to Astro—and then back to Eleventy! A reflection on using the right tool for the job, when many options are viable.
JS context managers
See how to adapt Python's context managers for use in JavaScript. Break free from clunky try...finally blocks with this one weird trick.
Making a theme selector
How to make a theme selector for your website, and why you might want to have more than one theme.
JS compare function
Exploring a small but mighty function that supercharges the JS Array sort method to rival Lodash's orderBy
Querying shadow DOM
Examples of how to query shadow DOM, and when you actually don't want to.
Flashlight: Making toys for the web
I made a toy flashlight for the web. It simulates darkening the web page and following the cursor. It looks somewhat convincingly like a flashlight. Enjoy!
JS Proxy and private properties
The default Proxy implementation doesn't work well with private properties, but we can fix this! I also explore other approaches to private data in JS.
Developing with web components
Thoughts on developing with web components from scratch; no UI libraries. This covers custom elements and very basic use of the <template> element. Shadow DOM is mentioned but not used.
Why I don't like useState
Why useState is so hard to use correctly, and what we can do about it.
Tagged unions in JavaScript
A disciplined approach to state management and domain modeling for JavaScript and TypeScript. Also known as algebraic data types / discriminated unions.
JavaScript iterators and more
A comparison and overview of generators, iterators, and iterables in JS.
React without JSX
A quick overview on using React without JSX or any build tools.
Broken promises
How to use promises effectively (written before async/await existed)
Compiler code generation
How to make code generation for a compiler.
Making a language
How to make a programming language from scratch in JS.
The leaning tower of Babel
An exploration of Babel's caveats.
JS gotchas with this and new
How JS's 'this' and 'new' work, and how to avoid issues with them.
Squiggle: a JS language
An introduction to Squiggle, a compile-to-JS programming language I made.