Answers for "javascript format number"

PHP
2

js format urcurency

// Create our number formatter.
var formatter = new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: 'USD',
});

formatter.format(2500); /* $2,500.00 */
Posted by: Guest on June-26-2020
1

Number format in javascript

function numberWithCommas(x) {
    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
Posted by: Guest on June-11-2021
2

js number format

function numberWithSpaces(x) {
    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
Posted by: Guest on October-08-2021
1

javascript number format

var x = parseFloat('9.656');

x.toFixed(0);           // returns 10
x.toFixed(2);           // returns 9.66
x.toFixed(4);           // returns 9.6560
x.toFixed(6);
Posted by: Guest on June-23-2021
0

format numbers js

function m(n,d){x=(''+n).length,p=Math.pow,d=p(10,d)
x-=x%3
return Math.round(n*d/p(10,x))/d+" kMGTPE"[x/3]}
Posted by: Guest on July-20-2021

Code answers related to "javascript format number"

Browse Popular Code Answers by Language