Skip to content

Instantly share code, notes, and snippets.

@SashaKolbasov
Last active March 31, 2019 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SashaKolbasov/1f153adf5a6594e687dfe30afbbfcdc4 to your computer and use it in GitHub Desktop.
Save SashaKolbasov/1f153adf5a6594e687dfe30afbbfcdc4 to your computer and use it in GitHub Desktop.
Thousands Separator
var price = Math.floor(price) + '';
price = price.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ');
function sep(n){return n.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g,'$1 ');}
function rmm(min,max){return Math.floor(Math.random()*(max-min+1))+min;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment