All Posts


Pinned post

Kindness is often underrated in tech communities. ...

JavaScript: The New Toys - Corrections and Clarifications

Pinned post

Book corrections and clarifications. ...

2023-04-28 12:00 UTC

React Repeating State Update

Posted 2023-04-28 12:00 UTC in react javascript errors

To save others from the debugging journey I've just been on, a brief note: If you're using React's useState hook, calling the state setter with a callback, and getting the weird behavior that your callback is being called repeatedly before eventually…

2023-03-26 15:00 UTC

Scrollable Tables / Fixed Table Headers

Posted 2023-03-26 15:00 UTC in css scrolling sticky table headers

I don't normally write about CSS because it's not my specialist area, but whenever I want to create a table with fixed headers, I keep having to re-discover the same techniques and pitfalls, so I thought I'd write it up — both to be useful to others…

2021-05-20 12:15 UTC

Singular 'they' and Programming Pronouns

Posted 2021-05-20 12:15 UTC in best-practices english pronouns

Despite little formal English education (I moved around a lot and kept missing, say, "parts of speech" when switching schools), I grew up with a passion for English and am a natural prescriptionist.¹ Which is to say, I grew up firmly believing there…

2021-04-24 10:00 UTC

Class Features Have Landed!

Posted 2021-04-24 10:00 UTC in javascript class proposals

The three big class proposals advanced to Stage 4 ("Finished") on the 19th! That means they have multiple implementations in the wild (though possibly still behind flags in some cases). The proposals are: Public and private instance fields Private…

2021-04-17 15:47 UTC

Misusing `map`

Posted 2021-04-17 15:47 UTC in javascript array map antipattern

Unfortunately, since late 2019 or early 2020 or so I'm increasingly seeing people (for instance, on Stack Overflow) misusing map like this: Note that: The map callback doesn't return anything The return value of map isn't used This is an antipattern…

2021-02-08 16:46 UTC

Let's talk about how to talk about promises

Posted 2021-02-08 16:46 UTC in javascript promises async await

Did you know... ...that "fulfilling" a promise and "resolving" a promise aren't the same thing? ...that a promise can be both "pending" and "resolved" at the same time? ...that lots of your code is creating these pending resolved promises? ...that…

2021-01-26 11:55 UTC

What is a String?

Posted 2021-01-26 11:55 UTC in javascript string unicode

JavaScript strings are slightly more complex than people sometimes think they are. That comes up in relation to various topics I like to write about, so I thought a post talking about the nature of JavaScript strings would be handy as something I…

2020-08-02 10:10 UTC

Legacy Edge and the Global Environment

Posted 2020-08-02 10:10 UTC in javascript globals web legacy-edge

When Microsoft Edge switched to Chromium, I was both happy and sad about it. Happy because the Chromium projects (V8, Blink, ...) are high-quality, up-to-date, and quite standards-focussed (even if Google may get ahead of itself sometimes), so it's…

2020-07-25 17:45 UTC

New: Relative Indexing Method for Indexables

Posted 2020-07-25 17:45 UTC in javascript new-toys indexable string array typed-array

The Stage 3 relative indexing method proposal adds an at method to strings, arrays, and typed arrays (collectively, "indexables"). Let's take a look! The Basics In its most basic form, the at method accepts an index and gives you the item at that…

2020-07-23 10:45 UTC

Proposal Updates from July 2020 Meeting

Posted 2020-07-23 10:45 UTC in javascript proposals tc39

The TC39 July 2020 meeting has concluded! I haven't had time to run through the notes yet, but several proposals I covered in Chapter 19 of the book ("A look ahead...") have moved to Stage 4 (e.g., finished)! Promise.any and AggregateError WeakRefs…

Why Make `fetch`'s Response Body a Stream?

Posted 2020-07-23 10:20 UTC in javascript web fetch

Émile Bergeron asked on Twitter why fetch's Response body is a stream: Can someone explain to me what's the advantage of a readable stream for the response body? In my mind, parsing the body as JSON should be idempotent, but there's probably a good…

`cleanupSome` Is Its Own Proposal Now

Posted 2020-07-23 09:45 UTC in javascript weakrefs finalizationregistry

In Chapter 19 of the book ("A look ahead...") I cover the WeakRefs proposal, which at the time was Stage 3. As of the July 2020 meeting, WeakRefs is Stage 4 (yay!) — but FinalizationRegistry.prototype.cleanupSome has been split off to its own…

2020-07-21 15:05 UTC

New: Logical Assignment Operators

Posted 2020-07-21 15:05 UTC in javascript new-toys

Since I finished the book, a new proposal has reached Stage 3 4 (as of the July 2020 meeting): Logical Assignment Operators. It adds three new compound assignment operators to the language: ||=, &&=, and ??=. At first glance it seems like these would…