How do I convert an integer to decimal in JavaScript?

javascript

Solution

Try this:

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

Problem

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?

Original source