Created
October 7, 2022 19:51
-
-
Save uqmessias/b95ac15647696dd97fb308c437aa1937 to your computer and use it in GitHub Desktop.
Format number to currency format
This file contains hidden or 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
const toCurrency = num => num.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment