>> ```js
>> function getRandomInteger(lower = 0, upper) {
>> return Math.floor(Math.random() * (upper - lower)) + lower;
>> }
>> ```
>
> This doesn't do what you appear to think it does. In particular,
> calling it with "getRandomInteger(5)" is *not* equivalent to calling
> it with "getRandomInteger(0, 5)", it's equivalent to calling it with
> "getRandomInteger(5, undefined)".
>
> This is precisely what the spec section you've quoted says, so I'm not
> sure how you're confused on this point.
Thanks! I didn’t look at the spec section, I (incorrectly) assumed I knew how
they worked. Then I don’t see a use case for this, I’d find it confusing.
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss