ParseFloat reemplacement with a limit of decimals to show

/ Published in: JavaScript
Save to your folder(s)

This snippet is a reemplacement for the parseFloat function of the Javascript language. This new function gets one or two parameters if only one parameter is defined the function is like the original parseFloat. If there are two parameter passed to the function, the first parameter must be a string or number and the second parameter must be the number of decimals we want to get, if the last decimal is greater or equal than five the last decimal is incremented by one.

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.