Created
January 29, 2019 07:02
-
-
Save vladanyes/7b8e538e479c1bebd21d5d63332df856 to your computer and use it in GitHub Desktop.
Format float numbers.
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 formatNumber(num) { | |
return Number(num).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1 ').replace('.', ',').replace('.00', ''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment