coffeescript-cookbook/coffeescript-cookbook.github.io

Arrays / Max Array Value / faulty example

log69 opened this issue · 2 comments

log69 commented

The example is wrong at the "Solution" section of "Max Array Value" in chapter "Arrays".

The following does not work:
Math.max [12, 32, 11, 67, 1, 3]

Instead it could be something like:
Math.max.apply null, [12, 32, 11, 67, 1, 3]

CoffeeScript supports splats. One can use that instead of apply:

Math.max [12, 32, 11, 67, 1, 3]...
log69 commented

Thanks.