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

0

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))
Posted by: Guest on April-10-2022

Code answers related to "Using Regular Expressions (regex) to Print JavaScript Number Format with Commas"

Code answers related to "Javascript"

Browse Popular Code Answers by Language