2021-03-26
1232
#vanilla javascript
Linda Ikechukwu
39897
Mar 26, 2021 â‹… 4 min read

New ES2021 features you may have missed

Linda Ikechukwu Frontend developer. Writer. Community Strategist. Building web interfaces that connect products to their target users.

Recent posts:

React logo on a bubbly orange background. Guide on building adaptive and responsive UIs in React Native for diverse devices.

Creating adaptive and responsive UIs in React Native

Design React Native UIs that look great on any device by using adaptive layouts, responsive scaling, and platform-specific tools.

Chinwike Maduabuchi
Nov 15, 2024 â‹… 9 min read
Enhancing Two-Way Data Binding In Angular

Enhancing two-way data binding in Angular

Angular’s two-way data binding has evolved with signals, offering improved performance, simpler syntax, and better type inference.

Alexander Godwin
Nov 14, 2024 â‹… 6 min read
Hand holding purple sticky notes for CSS sticky positioning guide.

Troubleshooting CSS sticky positioning

Fix sticky positioning issues in CSS, from missing offsets to overflow conflicts in flex, grid, and container height constraints.

Ibadehin Mojeed
Nov 13, 2024 â‹… 5 min read
Task Scheduling and cron Jobs in Node Using node-cron

Scheduling tasks in Node.js using node-cron

From basic syntax and advanced techniques to practical applications and error handling, here’s how to use node-cron.

Godwin Ekuma
Nov 12, 2024 â‹… 7 min read
View all posts

3 Replies to "New ES2021 features you may have missed"

  1. Hi, thanks for writing this good article, I love it.

    However I want to propose a correction for Promise.all in Promise.any part, The Promise.all should be reject if any of the promise rejected and resolve if all promise resolved.

    https://developer.mozilla.org/en-
    US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all

    Keep writing good stuff.

  2. “`
    const promise1 = new Promise((resolve) => setTimeout((resolve) => resolve, 300, ‘faster’);
    const promise2 = new Promise((reject) => setTimeout( (reject) =>reject, 100,”fastest”)
    const promise3 = new Promise((resolve) => setTimeout( (resolve) => resolve,700,’fast’);
    “`

    This promise code is just completely wrong, even if you fix the missing closing brackets. Your `setTimeout` calls take a `resolve => resolve` callback, but this reject is not the one from the promise, it’s an internal parameter of the callback. You might as well have passed the callback `foo => foo` , and it will have the same result.

    `promise2` even renames the “resolve” parameter as `reject`. Further adding to the wrongness.

    I believe you meant:

    “`
    const promise2 = new Promise((_, reject) => setTimeout(reject, 100,”fastest”));
    “`

Leave a Reply