Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Using Regular Expressions (regex) to Print JavaScript Number Format with Commas

const numb= 3436547568768345;

function separator(numb) {
    var str = numb.toString().split(".");
    str[0] = str[0].replace(/B(?=(d{3})+(?!d))/g, ",");
    return str.join(".");
}

console.log(separator(numb))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Using #Regular #Expressions #Print #JavaScript #Number #Format #Commas
ADD COMMENT
Topic
Name
9+6 =