Skip to content

Instantly share code, notes, and snippets.

@antonybudianto
Last active February 8, 2019 02:43
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 antonybudianto/9c6704370117e8151f35785910569841 to your computer and use it in GitHub Desktop.
Save antonybudianto/9c6704370117e8151f35785910569841 to your computer and use it in GitHub Desktop.
function cur (n) {
let minus = n < 0
n = minus ? Math.abs(n) : n
return (minus ? '-' : '') + (n).toString().split('').reverse().reduce((a,b,i) => i % 3 === 0 ? a+'.'+b : a+b).split('').reverse().join('')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment