DEV Community

Discussion on: The day I almost made a library on a bakery

Collapse
 
theodesp profile image
Theofanis Despoudis

This getExponential function name is confusing as it actually returns the length of the exponential part. A better name would be getExponentialLength or getExponentialPartLength.

Also this line const intConversor = Math.pow(10, exp) can quickly turn into infinity or integer overflow(> MAX_SAFE_INTEGER is the upper limit) so almost all operations will return the same number.