Advertisement
Verified Partner
Enterprise Cloud Infrastructure, GPU Clusters & AI APIs
Deploy high-throughput inference and quant trading pipelines with ultra-low latency.
Explore Platform β†’

Modern JavaScript (ES2024+): Modern Syntax, Async/Await & Event Loop

By Elena Rostova β€’ Beginner β€’ 11 min read β€’ Updated 2026-09-11

What You Will Master in This Tutorial

  • Master safe property traversal with Optional Chaining and Nullish Coalescing.
  • Understand deep object cloning with native structuredClone().

1. Nullish Coalescing and Optional Chaining

Before ES2020, developers used logical OR for defaults. Modern JavaScript solves this with ?? and ?.

JAVASCRIPT
const apiResponse = { user: { profile: { points: 0 } } };
const score = apiResponse.user?.profile?.points ?? 100;
console.log(score); // 0 (correctly preserved)
Note: Use ?? whenever 0 or false are valid domain values.
Advertisement
Verified Partner
Quantitative Trading Systems & 30 AI Business Blueprints
Build predictable monthly recurring revenue with retainers & automated bots.
View Blueprints β†’

Knowledge Check: Test Your Understanding

1. What is the difference between || and ?? in JavaScript?

Frequently Asked Questions

How do I deep clone an object without lodash?
Use structuredClone(obj), which is now natively supported across all modern runtimes.

Going deeper: modern JavaScript in practice

The features in this tutorial show up everywhere in production code once you start looking for them. Nullish coalescing and optional chaining replace defensive boilerplate, structuredClone removes a whole category of shared-reference bugs (and a lodash dependency), and async/await over the event loop is how every modern API call is written. In practice, fluency means knowing which tool matches the situation: ?? when 0 or an empty string is a real value, ?. when a path may legitimately be absent, and a real clone when the original object must not change. These are small operators with outsized effects on correctness, which is why interviewers and code reviewers keep coming back to them.

Common mistakes

Frequently asked questions

What is the difference between || and ??

As the quiz on this page puts it: || falls back on any falsy value, while ?? only falls back when the value is null or undefined β€” so 0 and false survive with ??.

How do I deep clone an object without lodash?

Use the built-in structuredClone(obj), which this tutorial notes is now natively supported across all modern runtimes and browsers.

Does optional chaining slow my code down?

Not meaningfully. The checks it performs are the same ones you would write by hand with && chains, just expressed in a shorter, safer syntax.

What happens if I never handle a rejected promise?

The rejection goes unhandled: browsers log a warning and Node will terminate the process on unhandled rejections in modern configurations. In production code, every async call should end in an await inside a try/catch or a .catch handler, so failures surface as deliberate error states instead of silent timing bugs that only appear under load. Modern runtimes surface these failures loudly precisely because silent async errors are among the most expensive bugs to track down.

Get 1 AI agent blueprint every week

Join the free PVT newsletter: one practical AI agent or automation you can build and sell, every week. No spam.