.findLast()
and .findLastIndex()
This blog post describes the ECMAScript proposal “Array find from last” by Wenlu Wang and Daniel Rosenwasser.
The ECMAScript proposal “Types as comments” (by Gil Tayar, Daniel Rosenwasser, Romulo Cintra, Rob Palmer, and others) is about adding type annotations to JavaScript (there is also an accompanying blog post).
Such type annotations would look similar to TypeScript’s and Flow’s annotations and are completely ignored at runtime.
In this blog post, I briefly explain how the proposed type annotations would work and then describe what I think about them.
Sometimes the name of a proposed feature (a method, a global variable, etc.) clashes with existing code and has to be changed. This blog post explains how that can happen and lists features that were renamed.
JavaScript has two kinds of values:
undefined
, null
, booleans, numbers, bigints, strings, symbols)The ECMAScript specification states:
A primitive value is a datum that is represented directly at the lowest level of the language implementation.
However, despite this fact, we can still use primitive values (other than undefined
and null
) as if they were immutable objects:
> 'xy'.length
2
This blog post answers the following question:
How do primitive values get their properties?
We’ll look at:
Each time, we’ll first examine what’s going on via JavaScript code and then investigate how the language specification explains the phenomena.
Note that JavaScript engines only mimick the external behavior of the language specification. Some of what the spec does internally is not very efficient (e.g. wrapping primitive values) and often done differently in engines.
Each of the primitive types boolean
, number
, bigint
, string
and symbol
has an associated wrapper class (Boolean
, Number
, BigInt
, String
, Symbol
). In this blog post, we examine what these classes are good for.
The proposal “Pipe operator (|>
) for JavaScript” (by J. S. Choi, James DiGioia, Ron Buckton and Tab Atkins) introduces a new operator. This operator is an idea borrowed from functional programming that makes applying functions more convenient in many cases.
This blog post describes how the pipe operator works and what its use cases are (there are more than you might expect!).
Dean Tribble (via Rob Palmer) has come up with a neat trick to create constants whose values are strings with their names. With a minor change, we can use it to set up symbol-valued constants.
.group()
and .groupToMap()
This blog post describes the ECMAScript proposal “Array grouping” by Justin Ridgewell.
structuredClone()
: deeply copying objects in JavaScriptSpreading is a common technique for copying objects in JavaScript:
Spreading has one significant downside – it creates shallow copies: The top levels are copied, but property values are shared.
structuredClone()
is a new function that will soon be supported by most browsers, Node.js and Deno. It creates deep copies of objects. This blog post explains how it works.
The ecosystem around delivering ECMAScript modules via packages is slowly maturing. This blog post explains how the various pieces fit together: