Loading...

JavaScript in 2026: 15 Practical Tricks That Actually Save You Time Every Day

1/11/2026

4 min read

JavaScript in 2026: 15 Practical Tricks That Actually Save You Time Every Day cover

Share

JavaScript in 2026 is no longer the chaotic language many still remember with frustration. The last few years brought a wave of genuinely useful features that make everyday development cleaner, safer, and faster — if you know how to use them.

Here are 15 practical JavaScript tricks that I believe every mid-to-senior developer should have in their toolbox in 2026. Less code golf, more real-world explanation, actual use-cases, and focus on what makes your life easier.

1. Promise.withResolvers() — Clean control over promises

JAVASCRIPT
const { promise, resolve, reject } = Promise.withResolvers();

button.onclick = () => resolve("User clicked!");

promise.then(message => alert(message));

Why it's better than the old pattern No more let resolve, reject; const p = new Promise((r1,r2) => { resolve = r1; reject = r2 }) boilerplate. Native, readable, supported in all modern browsers and Node since 2025.

Common real-world uses:

  • Waiting for modal close/confirm
  • Waiting for websocket message
  • Controlled promises in unit tests

2. Direct JSON imports — Config files as modules

JAVASCRIPT
// config.json
{
  "theme": "dark",
  "apiBase": "https://api.v3.example.com"
}

// app.js
import config from "./config.json" with { type: "json" };

document.body.className = config.theme;

Why this is huge in 2026

  • No fetch + .json() chain at runtime
  • Included at build time (Vite, esbuild, Rollup, Next.js, etc.)
  • TypeScript gives you great autocomplete too

3. Object.groupBy() — The cleanest way to group data

JAVASCRIPT
const orders = [
  { id: 1, status: "paid",   amount: 4200 },
  { id: 2, status: "pending", amount: 890 },
  { id: 3, status: "paid",   amount: 15000 }
];

const byStatus = Object.groupBy(orders, order => order.status);
// → { paid: [obj, obj], pending: [obj] }

When should you still use reduce? Basically never — unless you're forced to target very old environments (pre-2025).

4. Logical assignment operators (??=, ||=) — Smart defaults

JAVASCRIPT
function prepareUser(user) {
  user.settings ??= { theme: "system", notifications: true };
  user.stats ||= { visits: 0, lastActive: null };

  // Only increment if it already exists and is truthy
  user.stats.visits ||= 1;
}

Much cleaner than the old ternary or || chains in many cases.

5. Array.at() — Finally native negative indexing

JAVASCRIPT
const last = users.at(-1);
const secondLast = users.at(-2);

const first = users.at(0);     // same as users[0], but consistent style

More readable than users[users.length - 1] and doesn't break when array is empty.

6. Temporal — Dates & timezones finally done right (widely available 2026)

JAVASCRIPT
const nowInBudapest = Temporal.Now.zonedDateTimeISO("Europe/Budapest");

const meeting = Temporal.ZonedDateTime.from({
  year: 2026,
  month: 4,
  day: 15,
  hour: 14,
  minute: 30,
  timeZone: "Europe/Budapest"
});

const timeLeft = meeting.since(nowInBudapest);
console.log(timeLeft.toString()); // something like P3M4DT1H12M

The big message If you're still fighting moment.js, luxon or date-fns-tz for timezone math in 2026 → it's time to switch.

7. Modern Set operations — Beautiful data manipulation

JAVASCRIPT
const admins = new Set(["anna", "bela", "csaba"]);
const moderators = new Set(["bela", "dora", "eva"]);

const allPrivileged = admins.union(moderators);
const overlap = admins.intersection(moderators);     // bela
const pureAdmins = admins.difference(moderators);

Way more readable than spreading + filtering + new Set().

8. structuredClone() — Deep copy without dependencies

JAVASCRIPT
const gameState = structuredClone(originalState);
gameState.players[0].score += 100;

// originalState remains completely untouched

Advantages over JSON.parse(JSON.stringify())

  • Handles Date, Map, Set, RegExp, TypedArrays, etc.
  • Throws on circular references (safer)

9. Top-level await — Clean data loading in modules

JAVASCRIPT
// data.js
export const config = await fetchConfigFromDB();
export const translations = await loadTranslations();

// page.jsx
import { config, translations } from "./data.js";

Perfect fit for Next.js App Router, server components, and modern Node scripts.

10. True private class fields & methods (#)

JAVASCRIPT
class SafeCounter {
  #value = 0;

  #increment() {
    this.#value++;
  }

  getCount() {
    this.#increment();
    return this.#value;
  }
}

const counter = new SafeCounter();
counter.getCount(); // 1
// counter.#value → SyntaxError — really private!

Quick comparison table — Old vs 2026 style

   
Task Old / Classic way 2026 Recommended way Readability / Safety gain
Last array item arr[arr.length-1] arr.at(-1) ★★★☆☆
Deep copy JSON.parse(JSON.stringify()) structuredClone() ★★★★☆
Timezone-aware dates moment / luxon / date-fns-tz Temporal ★★★★★
Grouping arrays custom reduce Object.groupBy() ★★★★☆
Deferred / controllable promise manual closure Promise.withResolvers() ★★★☆☆
Real private fields WeakMap / Symbol tricks #private syntax ★★★★☆

Final thoughts

JavaScript in 2026 isn't about writing the shortest possible code anymore. It's about writing clear, maintainable, safe, and future-proof code using the powerful tools the language and runtimes already give us for free.

Which of these do you already use every day? Or is there a trick you think should be on this list in 2026?

Happy coding! 🚀

Cover Image Source: images.pexels.com


Enjoyed the article?

Discover the best tools from ReadyTools to streamline your daily work! Social media, SEO, design, and dev – all in one place, under one profile.

Try for free

Table of Contents

1. Promise.withResolvers() — Clean control over promises2. Direct JSON imports — Config files as modules3. Object.groupBy() — The cleanest way to group data4. Logical assignment operators (??=, ||=) — Smart defaults5. Array.at() — Finally native negative indexing6. Temporal — Dates & timezones finally done right (widely available 2026)7. Modern Set operations — Beautiful data manipulation8. structuredClone() — Deep copy without dependencies9. Top-level await — Clean data loading in modules10. True private class fields & methods (#)Quick comparison table — Old vs 2026 styleFinal thoughts

Related Posts

Unlocking HTML Secrets: 15 Essential and Lesser-Known HTML Tricks Every Web Developer Should Know in 2026

Unlocking HTML Secrets: 15 Essential and Lesser-Known HTML Tricks Every Web Developer Should Know in 2026

1/10/2026

Discover 15 essential & hidden HTML tricks for 2026: native accordions, dialogs, responsive images, accessibility hacks & more. Level up your web dev skill

The Best HTML Tricks of 2026 – Features You Should Be Using As Of Right Now

The Best HTML Tricks of 2026 – Features You Should Be Using As Of Right Now

1/10/2026

Discover the best HTML tricks of 2026: native popovers, grouped accordions, container style queries, modern dialogs & more – less JS, better UX!

What Is HEX and Why It Matters More Than You Think

What Is HEX and Why It Matters More Than You Think

1/9/2026

Compared to RGB or HSL, HEX is faster to work with in code and design tools. It is short, unambiguous, and universal.


Top tools

BoardlyLinksyChromoCodeHub

ReadyTools

CareersContactTools
Pricing7 days free
GuidesDocsBlogLaraVault

Select Language

Set theme

© 2026 ReadyTools. All rights reserved.