When to use logical OR vs. nullish coalescing in JavaScript
Introduction
It’s common to use the logical OR operator (||) to specify a default value:
function createSong(title, artist) {
return {
title: title || '(Untitled)',
artist: artist || '(Unknown)',
}
}
ES2020 adds the nullish c...
zachsnoek.hashnode.dev3 min read