From da53cf39a7e72c1c37296dbcc94670d577ca66a5 Mon Sep 17 00:00:00 2001 From: Bogdan Bacosca Date: Tue, 29 Nov 2022 11:20:59 +0200 Subject: [PATCH 1/4] line 217 "also" or something equivalent would be a good continuation of the "Just like" starting point from the beginning of the sentence. (maybe) --- 1-js/11-async/02-promise-basics/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/11-async/02-promise-basics/article.md b/1-js/11-async/02-promise-basics/article.md index 207fb2c8c0..6507cda243 100644 --- a/1-js/11-async/02-promise-basics/article.md +++ b/1-js/11-async/02-promise-basics/article.md @@ -214,7 +214,7 @@ The call `.catch(f)` is a complete analog of `.then(null, f)`, it's just a short ## Cleanup: finally -Just like there's a `finally` clause in a regular `try {...} catch {...}`, there's `finally` in promises. +Just like there's a `finally` clause in a regular `try {...} catch {...}`, there's a `finally` in promises also. The call `.finally(f)` is similar to `.then(f, f)` in the sense that `f` runs always, when the promise is settled: be it resolve or reject. From 79a66e347fd75a479a864a9c288468ccb2d95c16 Mon Sep 17 00:00:00 2001 From: Bogdan Bacosca Date: Tue, 29 Nov 2022 11:32:40 +0200 Subject: [PATCH 2/4] line 225 The addition of the word "if" would probably make more sense. --- 1-js/11-async/02-promise-basics/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/11-async/02-promise-basics/article.md b/1-js/11-async/02-promise-basics/article.md index 6507cda243..ff7a5b3868 100644 --- a/1-js/11-async/02-promise-basics/article.md +++ b/1-js/11-async/02-promise-basics/article.md @@ -222,7 +222,7 @@ The idea of `finally` is to set up a handler for performing cleanup/finalizing a E.g. stopping loading indicators, closing no longer needed connections, etc. -Think of it as a party finisher. No matter was a party good or bad, how many friends were in it, we still need (or at least should) do a cleanup after it. +Think of it as a party finisher. No matter if a party was good or bad, how many friends were in it, we still need (or at least should) do a cleanup after it. The code may look like this: From 706b8e6b58366595cd77e84ea6b9b96f58e3d854 Mon Sep 17 00:00:00 2001 From: Bogdan Bacosca Date: Tue, 29 Nov 2022 16:53:39 +0200 Subject: [PATCH 3/4] line 294 Replaced resolved with settled for consistency. --- 1-js/11-async/02-promise-basics/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/11-async/02-promise-basics/article.md b/1-js/11-async/02-promise-basics/article.md index ff7a5b3868..fdf04af144 100644 --- a/1-js/11-async/02-promise-basics/article.md +++ b/1-js/11-async/02-promise-basics/article.md @@ -291,7 +291,7 @@ Sometimes, it might be that a promise is already settled when we add a handler t In such case, these handlers just run immediately: ```js run -// the promise becomes resolved immediately upon creation +// the promise becomes settled immediately upon creation let promise = new Promise(resolve => resolve("done!")); promise.then(alert); // done! (shows up right now) From ee44f80c3666bc7192cceb81a4c3672aa02c3883 Mon Sep 17 00:00:00 2001 From: Bogdan Bacosca Date: Tue, 29 Nov 2022 17:25:00 +0200 Subject: [PATCH 4/4] line 327 switched 'resolves' with 'settles' for consistency --- 1-js/11-async/02-promise-basics/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/11-async/02-promise-basics/article.md b/1-js/11-async/02-promise-basics/article.md index fdf04af144..7e6ac15a66 100644 --- a/1-js/11-async/02-promise-basics/article.md +++ b/1-js/11-async/02-promise-basics/article.md @@ -324,7 +324,7 @@ function loadScript(src, callback) { Let's rewrite it using Promises. -The new function `loadScript` will not require a callback. Instead, it will create and return a Promise object that resolves when the loading is complete. The outer code can add handlers (subscribing functions) to it using `.then`: +The new function `loadScript` will not require a callback. Instead, it will create and return a Promise object that settles when the loading is complete. The outer code can add handlers (subscribing functions) to it using `.then`: ```js run function loadScript(src) {