Skip to content

Instantly share code, notes, and snippets.

@herusdianto
Last active August 29, 2015 14:21
Show Gist options
  • Save herusdianto/7c4f202d78e762b00c5f to your computer and use it in GitHub Desktop.
Save herusdianto/7c4f202d78e762b00c5f to your computer and use it in GitHub Desktop.
Javascript Number To Local Format

Script:

var number;

number = 1000000;
number.toLocaleString();
number.toLocaleString('id-ID');

number = 1500000.59
number.toLocaleString();
number.toLocaleString('id-ID');

Output:

"1,000,000"
"1.000.000"

"1,500,000.59"
"1.500.000,59"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment