-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2/4/11 9:51 AM, jemptymethod wrote: > I'm setting ExtJS form values in one of their ubiquitous config > objects based on JSON data from an Ajax call. > > For currency fields I am calling "toFixed(2)" on the numbers such as: > > jsonObj.shippingAndHandling.toFixed(2) > jsonObj.totalDueToday.toFixed(2) > > Etcetera >
Be careful with `toFixed()` and rounding. To test, try the following in IE: alert((.9).toFixed()); - -- Bryan Forbes http://www.reigndropsfall.net GPG Fingerprint 3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1MOhIACgkQOIgX4HDKDz2t0gCfczxaiWjc2BgkZ3DQEPfcFNYL Bi4AoIdK20nAc9bumWfiHyApm5PSVAM/ =1tgE -----END PGP SIGNATURE----- -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
