Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery thousand separator

function addCommas(nStr) {
    nStr += '';
    var x = nStr.split('.');
    var x1 = x[0];
    var x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(d+)(d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
    }
    return x1 + x2;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue event focus out 
Javascript :: date js 
Javascript :: momentTimeZone 
Javascript :: How to remove title in material-table 
Javascript :: react native slow performance after load iamges 
Javascript :: js get type of variable 
Javascript :: setimmediate vs settimeout 
Javascript :: what is the meanof using next in nodejs 
Javascript :: js loop through array backwards with foreach 
Javascript :: how to add two attay into object in javascript 
Javascript :: eslint-disable-next-line 
Javascript :: how to get id of current element clicked 
Javascript :: object length javascript 
Javascript :: owl.js cdn 
Javascript :: angular filter ngfor 
Javascript :: contains is not a function javascript 
Javascript :: react navigation header background color 
Javascript :: call javascript function use array 
Javascript :: how to find length of array in javascript without using length method 
Javascript :: convert cookies to json javascript 
Javascript :: moment time ago format reactjs 
Javascript :: javascript tolocaletimestring 
Javascript :: local storage remove multiple items 
Javascript :: jquery table row count 
Javascript :: javascript absolute path 
Javascript :: javascript loop through child elements 
Javascript :: how to integrate redux dev tool to react application 
Javascript :: jquery replace html 
Javascript :: disable button in swal popup 
Javascript :: how to disable copy paste in input js 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =