What do square brackets around a property name in an object literal mean?

Only recently with ES6. They are called “computed property names”

From MDN:

Starting with ECMAScript 2015, the object initializer syntax also
supports computed property names. That allows you to put an expression
in brackets [], that will be computed as the property name.

Leave a Comment