From documentation:
This method behaves identically to the global function parseInt()
But, as it's experimental, the compatibility is worst. For example, is not available in IE or Safari.
So, why should a developer use Number.parseInt()?
The use of Number.parseInt
being encouraged over parseInt()
is due to a trend in the JavaScript community of get away from using globals. The Mozilla documentation on Number.parseInt
states:
...and is part of ECMAScript 2015 (its purpose is modularization of globals).
There you have it. It's because of global-phobia :)