From 6c9706625f7f896e2c2e1b4a64baadc6f9ccc604 Mon Sep 17 00:00:00 2001 From: Tlekbai Ali Date: Fri, 26 Jun 2020 11:42:18 +0600 Subject: [PATCH] Update README.md Add clarification --- subjects/keep-trying-or-giveup/README.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/subjects/keep-trying-or-giveup/README.md b/subjects/keep-trying-or-giveup/README.md index cb69cecc..867ff618 100644 --- a/subjects/keep-trying-or-giveup/README.md +++ b/subjects/keep-trying-or-giveup/README.md @@ -3,25 +3,23 @@ ### Instructions Create a `retry` function, that takes 2 arguments -- a `count`, that tells how many retries must be done -- an async `callback`, that will be call every try +- a `count` indicates maximum amount of retries +- an async `callback`, that will be called on every try -and it return a new function, passing arguments given to the -callback on every tries. +`retry` returns a function that calls and returns value from `callback` +function passing its arguments and catches errors. If number of errors +exceeds `count` then throw an `Error`. > for count of 3, the function will be called at most 4 times: > the initial call + 3 retries. - Create a `timeout` function, that takes 2 arguments -- a `delay`, that tells how long to wait -- an async `callback`, that will be call - -and it return a new function, passing arguments given to the callback -and either the async callback resolve before the delay is reached, -in that case we return the value from the callback, -or reject an error using the message `"timeout"` +- a `delay` indicates maximum wait time +- an async `callback`, that will be called +`timeout` returns a function either that calls and returns value from `callback` +function passing its arguments or returns `Error('timeout')` if `callback` didn't +resolve before `delay` time has reached. ### Notions