Javascript String commaSeparate()

Description

Javascript String commaSeparate()


String.prototype.commaSeparate = function(){
    var n = this.split(".");
    n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
    return n.join(".");
};



PreviousNext

Related