there are of course use cases where it’s beneficial to use it, for example if you want to extrapolate an integer out of a floating number, which is a good 50% faster than Math.round().
Two things here -
parseInt doesn't do any rounding, only truncation. The equivalent Math function would be Math.trunc:
Two things here -
parseIntdoesn't do any rounding, only truncation. The equivalentMathfunction would beMath.trunc:Running benchmarks in Chrome, the performance benefit of
parseIntoverMath.roundis reversed if you explicitly convert to a number first:Good to know, thanks!
Kudos!