Avatar

Level 10

Hi,

In JavaScript you can use the toFixed method of the number object to round to an whole number. So if variable total had a value of 10.5 then total.toFixed() would give you 11.

One catch is that toFixed() returns a string value so it might not format exactly how you expect, so

parseInt(total.toFixed())

Will return a number value.

Regards

Bruce