Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/29/2016 in Posts

  1. var n = 12999123; var out = String(n) .split('') .reverse() .map(function(el,i){return ++i%3 ? el : ' ' + el;}) .reverse() .join('') +' грн'; console.log(out); или так без реверсов var n = 12999123; var out = String(n).split('').reduceRight(function(p,c,i){ return (++i%3?'':' ')+c+p; }); console.log(out); Но это все для целых чисел, для дробных уже не будет работать как надо.
    1 point
This leaderboard is set to Kiev/GMT+02:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy