Skip to content

Instantly share code, notes, and snippets.

@alexcmgit
Created April 17, 2020 17:04
Show Gist options
  • Save alexcmgit/6ba86e93f9e17c2e7c52c4081835009e to your computer and use it in GitHub Desktop.
Save alexcmgit/6ba86e93f9e17c2e7c52c4081835009e to your computer and use it in GitHub Desktop.
function abbreviateNumber(num) {
return Math.abs(num) > 999
? Math.sign(num) * (Math.abs(num) / 1000).toFixed(1) + 'k'
: Math.sign(num) * Math.abs(num);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment