marijnh / Eloquent-JavaScript

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

Chapter 5 "Your Own Loop": clarity? #243

Closed nielsbom closed 6 years ago

nielsbom commented 6 years ago

Hi, me again :-)

In the exercise you don't explicitly say that a (for) loop should or should not be used. I was first thinking: how do I do this without an actual loop (which is of course possible but a little harder). And then I thought "he probably just wants a regular loop, but then wrapped in a higher order function", which turned out to be very simple.

So, for me, the exercise wasn't super clear. I think it might help to state in the exercise that the solution is basically to wrap a (classic) for loop in a higher order function. Then again: others might feel differently :-)

marijnh commented 6 years ago

Attached patch tries to clarify this.