marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
2.99k stars 789 forks source link

Chapter 11 code example attempt call should start with parameter '0' instead of '1' #511

Closed pstarliu closed 4 years ago

pstarliu commented 4 years ago

In the code example in section 'Networks are hard'

Otherwise if called with attempt(1), it will reject the promise on the third attempt instead of fourth, and will give up after 750 ms instead of after a second, both contradict with the text following the code example.

marijnh commented 4 years ago

Ah, thanks for spotting that. Attached patch fixes the inconsistency.

pstarliu commented 4 years ago

And I enjoy read your books by the way, I've read the first edition and now halfway on the second edition.