Question:
There is a code that performs calculations and displays the result.
rez = Math.round(numb*pay*2.1/100);
$(".result p span").text(rez);
The task is to split the displayed number into digits, i.e. print 1000000 instead of 1000000.
I'm trying this option:
rez = Math.round(numb*pay*2.1/100);
var outrez = rez.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ');
$(".result p span").text(outrez);
But there is no result at all. Tell me how to fix. Thank you.
Answer:
Try like this:
(1000000).toLocaleString('ru')