How do I convert an integer to decimal in JavaScript?

Viewed 53382

I have a number in JavaScript that I'd like to convert to a money format:

556633 -> £5566.33

How do I do this in JavaScript?

4 Answers

Try this:

var num = 10;
var result = num.toFixed(2); // result will equal string "10.00"

This works:

var currencyString = "£" + (amount/100).toFixed(2);
Related