The Number() type cast works in a manner similar to parseInt() and parseFloat(). | ||||||||||||||||||||
Except that it converts the entire value, not just part of it. | ||||||||||||||||||||
parseInt() and parseFloat() only convert up to the first invalid character (in strings),so "4.5.6" becomes "4.5". | ||||||||||||||||||||
Using the Number() type cast, "4.5.6". | ||||||||||||||||||||
If a string value can be converted entirely, Number() decides whether to use parseInt() or parseFloat(). | ||||||||||||||||||||
|