Last active
June 30, 2022 07:22
-
-
Save tiendatleo/5d49f39b38ce4cff5b911a9ecafdd36f to your computer and use it in GitHub Desktop.
[JS] Convert number with such a number of decimals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ParseFloat(str,val) { | |
str = str.toString(); | |
str = str.slice(0, (str.indexOf(".")) + val + 1); | |
return Number(str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment