Converting to a Number : Type Conversion : Number Data Type JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Number Data Type » Type Conversion »

 

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.





HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Number Data Type
» Type Conversion