~ overflow ~

Javascript ParseInt Vs. ParseFloat

by z3n on May.01, 2010, under Coding, Tips & Hints

Problem:

While debbuging an javascript application i found out a wrong calculation result.

Solution:

Apparently javascript been developed my microsoft, due the extensive issues with many misbehaviors it’s quite sad to find out that there’s no way to escape from them.

var test="08";

alert(parseInt(test)+1); // will return 1
alert(parseFloat(test)+1); // will return 9, as supposed to
:, , , ,


No comments for this entry yet...

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!