I wouldn't use it in my code because at code review I'd get comments on my code not being explicit (provided this could even get to code review stage. because nowadays eslint would eat you alive for this!). So, I'd instead use Math. methods. But I can agree this is an elegant way.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
A quick shortcut to just remove the decimal part:
Beware - this isn't the same as
round
,floor
, orceil
I wouldn't use it in my code because at code review I'd get comments on my code not being explicit (provided this could even get to code review stage. because nowadays eslint would eat you alive for this!). So, I'd instead use Math. methods. But I can agree this is an elegant way.