Merge pull request #431 from bardiarastin/patch-1

fix a small mistake in calling Math.max
This commit is contained in:
Ilya Kantor 2018-06-07 16:56:09 +03:00 committed by GitHub
commit af5a7ac590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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. *Spread operator* to the rescue! It looks similar to rest parameters, also using `...`, but does quite the opposite.