From 23823a775db18409fc3f3f679429bd51928c25d3 Mon Sep 17 00:00:00 2001 From: KashviYadav09 Date: Sun, 1 Feb 2026 22:32:16 +0530 Subject: [PATCH 1/2] Fix example to clearly handle rejected promises --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f1159781..4d22cd2f 100644 --- a/README.md +++ b/README.md @@ -2047,17 +2047,16 @@ try { For the same reason you shouldn't ignore caught errors from `try/catch`. -**Bad:** -```javascript +**Good:** getdata() - .then(data => { - functionThatMightThrow(data); + .then(user => { + return getOrders(user.id); }) .catch(error => { - console.log(error); + console.error(error); }); -``` + **Good:** From 5fca2eeeac4857100d25a37d44a2ad2350fe44a5 Mon Sep 17 00:00:00 2001 From: KashviYadav09 Date: Sun, 1 Feb 2026 22:44:21 +0530 Subject: [PATCH 2/2] Remove misleading link from 'Don't over-optimize' section --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4d22cd2f..41913f7d 100644 --- a/README.md +++ b/README.md @@ -977,10 +977,10 @@ function combine(val1, val2) { ### Don't over-optimize Modern browsers do a lot of optimization under-the-hood at runtime. A lot of -times, if you are optimizing then you are just wasting your time. [There are good -resources](https://github.com/petkaantonov/bluebird/wiki/Optimization-killers) -for seeing where optimization is lacking. Target those in the meantime, until -they are fixed if they can be. +times, if you are optimizing then you are just wasting your time. Focus on writing +clear and readable code first, and optimize only when you have identified real +performance issues. + **Bad:**