Skip to content

Instantly share code, notes, and snippets.

@afrijaldz
Last active February 18, 2021 07:22
Show Gist options
  • Save afrijaldz/8328b87dc0c8eac7088bdf9b9e812a34 to your computer and use it in GitHub Desktop.
Save afrijaldz/8328b87dc0c8eac7088bdf9b9e812a34 to your computer and use it in GitHub Desktop.
mengubah angka (number) menjadi string dengan penghubung separator ribuan
function numberWithDots(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment