Home About Skills Products Work
Projects Services Experience
Learn
Tutorials Courses Blogs Resources
Contact
Blog · JavaScript

Modern JavaScript (ES6+) Features You Should Be Using

Modern JavaScript (ES6+) Features You Should Be Using

ES6 (2015) and the yearly releases since have quietly replaced a lot of "clever" old JavaScript patterns with plain, readable syntax. If your code still looks like 2014 jQuery-era JS, these are the features worth adopting first.

Template Literals

const name = 'Bikesh';
console.log(`Hello, ${name}! You have ${5 + 3} new messages.`);

No more string concatenation with + — and multi-line strings work without escape characters.

Destructuring and Default Parameters

function greet({ name, role = 'Developer' } = {}) {
  return `${name} works as a ${role}`;
}

Pull exactly the properties you need out of an object argument, with sensible fallbacks, in the function signature itself.

Spread and Rest

const base = { a: 1, b: 2 };
const merged = { ...base, c: 3 }; // { a: 1, b: 2, c: 3 } — new object, base untouched

function sum(...nums) {
  return nums.reduce((a, b) => a + b, 0);
}

Optional Chaining and Nullish Coalescing

const city = user?.address?.city ?? 'Unknown';

Without ?., accessing address.city on a user with no address throws immediately. Without ??, a falsy-but-valid value like 0 or an empty string would incorrectly fall back to the default — ?? only falls back on null/undefined.

Modules: import/export

// utils.js
export function formatDate(date) { /* ... */ }

// app.js
import { formatDate } from './utils.js';

This is what every modern build tool (Vite, Webpack, Next.js) expects — no more manually managing <script> tag order.

Array/Object Methods Worth Knowing

  • Array.at(-1) — get the last item without arr[arr.length - 1]
  • Object.entries(obj) — loop over key-value pairs directly
  • structuredClone(obj) — a real deep clone, no JSON.parse/stringify hack needed

None of this is exotic — it's just JavaScript as it's actually written today, and it's exactly what you'll see the moment you open a modern React or Next.js codebase.

JavaScript Fundamentals Every Beginner Should Master

JavaScript Fundamentals Every Beginner Should Master

Variables, functions, arrays, objects, and the DOM — the plain JavaScript every framework is built on top of.

Async/Await and Promises in JavaScript: A Practical Guide

How Promises actually work, why async/await is just readable syntax on top of them, and the parallel-fetching mistake almost everyone makes.

React Hooks Explained: useState, useEffect, and Beyond

React Hooks Explained: useState, useEffect, and Beyond

A practical walkthrough of useState, useEffect, useRef, and useContext — the hooks that cover the majority of real React component logic.

Esc