JavaScript global functions can be used on all JavaScript data types. The most relevant methods, when working with numbers, are these 3 JavaScript functions which can be used to convert variables to numbers:
Method | Description |
---|---|
Number() | Returns a number, converted from its argument. |
parseFloat() | Parses its argument and returns a floating point number |
parseInt() | Parses its argument and returns an integer |
These methods are not number methods, but global JavaScript methods.