Merge pull request #431 from bardiarastin/patch-1
fix a small mistake in calling Math.max
This commit is contained in:
commit
af5a7ac590
1 changed files with 1 additions and 1 deletions
|
@ -145,7 +145,7 @@ alert( Math.max(arr) ); // NaN
|
|||
*/!*
|
||||
```
|
||||
|
||||
And surely we can't manually list items in the code `Math.max(arg[0], arg[1], arg[2])`, because we may be unsure how many there are. As our script executes, there could be a lot, or there could be none. And that would get ugly.
|
||||
And surely we can't manually list items in the code `Math.max(arr[0], arr[1], arr[2])`, because we may be unsure how many there are. As our script executes, there could be a lot, or there could be none. And that would get ugly.
|
||||
|
||||
*Spread operator* to the rescue! It looks similar to rest parameters, also using `...`, but does quite the opposite.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue