5. 8. 5. Converting to a Number |
|
JavaScript has two methods for converting non-number primitives into numbers: parseInt() and parseFloat(). |
parseInt() converts a value into an integer. |
parseFloat() converts a value into a floating-point number. |
These methods only work properly when called on strings; all other types return NaN. |