๐ŸŸจ JavaScript Basics

Modern JavaScript: 10 ES2024+ Features You Should Be Using

By The CodeCraft Teamยทยท8 min read
Modern JavaScript code snippets stacked vertically

JavaScript has changed more in the last five years than in the previous twenty. Here are the modern features that genuinely make your code shorter, safer, and easier to read.

  1. Optional chaining โ€” user?.profile?.name
  2. Nullish coalescing โ€” value ?? "fallback"
  3. Logical assignment โ€” a ??= 10
  4. structuredClone() for deep copies
  5. Array.prototype.at(-1) โ€” last element
  6. Object.groupBy() โ€” group an array by key
  7. Top-level await in ES modules
  8. Promise.withResolvers()
  9. String.prototype.replaceAll()
  10. Private class fields with #

Examples

const last = arr.at(-1);
const grouped = Object.groupBy(users, u => u.role);
const copy = structuredClone(obj);

Frequently asked questions

Do I need a transpiler for these?

All major evergreen browsers support these. Drop Babel for typical greenfield projects in 2026.

Enjoyed this article?

Share it with a fellow developer or explore more tutorials in our blog.

More articles

Related articles