JavaScript for WordPress › Forums › Vanilla JavaScript › 1.2.06 – Data Types – Numbers & NaN – parseInt vs parseFloat vs Number › Reply To: 1.2.06 – Data Types – Numbers & NaN – parseInt vs parseFloat vs Number
You are right!
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.
Somethings like different index points though should make sense as you move into arrays http://stackoverflow.com/questions/9528433/behavior-difference-between-parseint-and-parsefloat
Hope that helps? Great question!!!