Javascript toFloat()
This week while writing some code, we needed to change a field from a float (which display about 19 decimal points by default) to a number with was 2 decmial points.
In PHP this isnt an issue but we thought that in Javascript it would be.
If you are running
Javascript 1.5 or above, then you can use the
toFixed() function.
Basically
Number.toFixed(2) would display the number with 2 decimal places only.
Found it handy and useful, but we did have some browser related issues.
Hope you found this helpful and handy
ttu l8r then .....
0 COMMENTS