You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During code review #103, we observed 4 occurrences of Math.trunc, which MDN describes like so:
The Math.trunc() static method returns the integer part of a number by removing any fractional digits.
[...]
Unlike the other three Math methods: Math.floor(), Math.ceil() and Math.round(), the way Math.trunc() works is very simple. It truncates (cuts off) the dot and the digits to the right of it, no matter whether the argument is a positive or negative number.
In the cases we reviewed, it seems like the argument should be non-negative, and we recommend using Math.floor so readers don't misconstrue the argument as possibly negative.
The text was updated successfully, but these errors were encountered:
During code review #103, we observed 4 occurrences of
Math.trunc
, which MDN describes like so:In the cases we reviewed, it seems like the argument should be non-negative, and we recommend using
Math.floor
so readers don't misconstrue the argument as possibly negative.The text was updated successfully, but these errors were encountered: