Modern JavaScript Features I Actually Use in Production
Optional chaining, nullish coalescing, private fields, and other ES2020+ features have fundamentally changed how I write JavaScript. Here is what I reach for daily. When optional chaining landed in ES2020, it eliminated a pattern I had been writing for years: data && data.user && data.user.name . Now I write data?.user?.name and it short-circuits to undefined if any intermediate value is null or undefined. The same operator works for optional function calls ( callback?.() ) and computed property access ( arr?.[0] . though that pattern is less common). Nullish Coalescing vs Logical OR Nullish coalescing ( ?? ) is different from logical OR ( || ) in a crucial way that many developers overlook. || treats all falsy values as needing a default. empty string, zero, false, null, and undefined all trigger the fallback. ?? only defaults for null and undefined. This means count?? 10 preserves a count of 0, while count || 10 would silently replace it with 10. In practice, I use ?? for most default values and reach for || only when I explicitly want to replace falsy values. This distinction has prevented several subtle bugs in form handling where zero was…