In this blog post, we examine the ECMAScript proposal “Ergonomic brand checks for private fields” (by Jordan Harband). It proposes a compact way for checking if an object has a given private field.
Object.prototype.hasOwnProperty()
In this blog post, we examine the ECMAScript proposal “Accessible Object.prototype.hasOwnProperty()
” (by Jamie Kyle and Tierney Cyren). It proposes a new, simpler way of checking if an object has an own (non-inherited) property.
In this blog post, we examine the ECMAScript proposal “JSON modules” (by Sven Sauleau, Daniel Ehrenberg, Myles Borins, and Dan Clark). It lets us import JSON data as if it were an ECMAScript module.
In this blog post, we examine the ECMAScript proposal “Error cause” (by Chengzhong Wu and Hemanth HM). It describes a feature where instances of Error
can optionally specify that they were caused by another error.
undefined
vs. null
revisitedMany programming languages have one “non-value” called null
. It indicates that a variable does not currently point to an object – for example, when it hasn’t been initialized yet.
In contrast, JavaScript has two such non-values: undefined
and null
. In this blog post, we examine how they differ and how to best use or avoid them.
The ECMAScript proposal “Import assertions” (by Myles Borins, Sven Sauleau, Dan Clark, and Daniel Ehrenberg) introduces syntax for associating metadata with import statements. In this blog post, we examine what that looks like and why it’s useful.
for
vs. for-in
vs. .forEach()
vs. for-of
This blog post compares four ways of looping over Arrays:
The for
loop:
for (let index=0; index < someArray.length; index++) {
const elem = someArray[index];
// ···
}
The for-in
loop:
for (const key in someArray) {
console.log(key);
}
The Array method .forEach()
:
someArray.forEach((elem, index) => {
console.log(elem, index);
});
The for-of
loop:
for (const elem of someArray) {
console.log(elem);
}
for-of
is often the best choice. We’ll see why.
The iOS/iPadOS app iSH is available on the app store and runs Linux via x86 emulation. And you can install Node.js on it!
Recently, we have seen an uptick of JavaScript tools being written in languages other than JavaScript. This blog post lists a few examples and explains the appeal of not using JavaScript.
Update 2021-06-22: The 121st Ecma General Assembly approved the ECMAScript 2021 language specification, which means that it’s officially a standard now.
This blog post describes what’s new.