Last active
November 6, 2022 20:19
-
-
Save Renik07/59d1c1927f7c3417d496f508b7ccd938 to your computer and use it in GitHub Desktop.
Add spaces between 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
const price = (value: number) => value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ') + ' $'; | |
// 99 450 $ | |
price(99450); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment