I like to output a formatted number with a space after every two numbers, I've tried this:
function twoSpaceNumber(num) {
return num.toString().replace(/\B(?<!\.\d)(?=([0-9]{2})+(?!\d))/g, " ");
}
twoSpaceNumber(12345678)
=> 1 23 45 67 89
( should start with 12 ? )
and also when it starts with 0 I had very strange output
twoSpaceNumber(012345678)
=> 12 34 56 78