I just finished 1.2.06 – Data Types – Numbers & NaN
Maybe I’m getting ahead of myself here… but I’m a little confused by the distinction between parseInt vs parseFloat, specifically the need for the distinction. I understand that parseInt is for whole numbers and parseFloat is for numbers with decimal points. What I don’t understand is why we need to have two different functions, especially when the Numbers function also exists and doesn’t distinguish between integers or decimal points. The only thing I could think of would be if a number was entered or computed which would result in a decimal point, but only a whole number would be needed moving forward? I did a few Google searches and all I found was far more advanced than where I’ve gotten so far in this course (radix, octal, etc). Any insight would be appreciated–thanks!
I am not sure of the specific reasons, except that the creator of JS thought it would be helpful to include both of these functions. I imagine the influence of strongly typed languages and really wanted to clear what type of number you would get back was part of it.
You’re right the differences you pointed out are quite technical and not something you probably need to really understand at this point.