Jquery Number Formating

Add commas for number

by Alvin Olavarrieta

HTML

<span>10300</span>

<p>HELLO</p>

JavaScript

$.extend({
    numberformat: function(value) {
        value = parseFloat(value);
        return $.isNumeric(value) ? value.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,") : value;
    },
    moneyformat: function(value) {
        value = parseFloat(value); 
        return $.isNumeric(value) ? '$'+value.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,") : value;
    }
});


$('span').text($.moneyformat(3500))

$('p').text($.camelCase('hELLO'));

console.log($.now())