From 65d7330b0087f1491ef37d1800908ff7c7774aff Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Sat, 5 Jul 2025 12:36:29 +0300 Subject: [PATCH 1/2] doc: improve description of tasks --- JavaScript/Tasks/1-promisify-problem.js | 8 +++++--- JavaScript/Tasks/2-abort-problem.js | 7 +++++-- JavaScript/Tasks/4-iterator-problem.js | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/JavaScript/Tasks/1-promisify-problem.js b/JavaScript/Tasks/1-promisify-problem.js index 0170989..a90e9f3 100644 --- a/JavaScript/Tasks/1-promisify-problem.js +++ b/JavaScript/Tasks/1-promisify-problem.js @@ -1,8 +1,10 @@ 'use strict'; -// Task: implement a cancelable promise by passing `timeout: number` -// as an option to the promisified function (last argument, -// replacing the callback). +// Task: implement a cancelable promisify function. +// Allow passing new argument `timeout: number` after the last argument +// to the original function replacing the callback. The promisify should check +// the existence of timeout and apply logic to implement it on top of calling original function +// There is no need to propagate timeout to original function. const promisify = (fn) => (...args) => { const promise = new Promise((resolve, reject) => { diff --git a/JavaScript/Tasks/2-abort-problem.js b/JavaScript/Tasks/2-abort-problem.js index e6646a2..a765bc5 100644 --- a/JavaScript/Tasks/2-abort-problem.js +++ b/JavaScript/Tasks/2-abort-problem.js @@ -1,7 +1,10 @@ 'use strict'; -// Task: implement cancellation by passing `AbortSignal` as an option -// to the promisified function (last argument, replacing the callback). +// Task: implement a cancelable promisify function with AbortController. +// Allow passing new argument `AbortSignal` after the last argument +// to the original function replacing the callback. The promisify should check +// the existence of timeout and apply logic to implement it on top of calling original function +// There is no need to propagate AbortSignal to original function. // Hint: Create `AbortController` or `AbortSignal` in the usage section. const promisify = (fn) => (...args) => { diff --git a/JavaScript/Tasks/4-iterator-problem.js b/JavaScript/Tasks/4-iterator-problem.js index 5785391..9ba6933 100644 --- a/JavaScript/Tasks/4-iterator-problem.js +++ b/JavaScript/Tasks/4-iterator-problem.js @@ -1,8 +1,8 @@ 'use strict'; -// Task: ensure all blocks of code in the usage section iterate in parallel. -// Currently, only the last block (of 3) works. Fix this issue so that -// all blocks can iterate concurrently using a single `Timer` instance. +// Task: ensure all blocks of code in the usage section iterate in parallel +// on the same timer instance getting the same values. Currently, only the last block (of 3) works. +// Update the implementation of Timer so that all blocks can iterate concurrently using a single Timer instance. class Timer { #counter = 0; From 937b546a9b5a028123f93379a9b42184ddad7824 Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Sat, 5 Jul 2025 12:37:52 +0300 Subject: [PATCH 2/2] doc: improve description of tasks --- JavaScript/Tasks/2-abort-problem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JavaScript/Tasks/2-abort-problem.js b/JavaScript/Tasks/2-abort-problem.js index a765bc5..e696c3f 100644 --- a/JavaScript/Tasks/2-abort-problem.js +++ b/JavaScript/Tasks/2-abort-problem.js @@ -3,7 +3,7 @@ // Task: implement a cancelable promisify function with AbortController. // Allow passing new argument `AbortSignal` after the last argument // to the original function replacing the callback. The promisify should check -// the existence of timeout and apply logic to implement it on top of calling original function +// the existence of AbortSignal and apply logic to implement it on top of calling original function // There is no need to propagate AbortSignal to original function. // Hint: Create `AbortController` or `AbortSignal` in the usage section. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy