daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Mar 20th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function thousandDelimiter (num, delimiter) {
  2.     delimiter = delimiter || ',';
  3.     return (parseInt(num) || 0).toString().split('').reduce(function (str, item, idx, arr) {
  4.         return str + (((idx - arr.length % 3) % 3 === 0 && idx > 0) ? delimiter : '') + item;
  5.     }, '');
  6. }
RAW Paste Data
Top