JavaScript Functions: Number()

By: Dusty Arlia
Published on September 4, 2012
Last Updated on Sunday, July 12, 2015 at 3:25 PM
Total Updates: 5

The Number() method will convert a variable that is a number with a string data type to a variable that is a number with a number data type (the number will not change, only the data type). If the variable is a string with value that cannot be interpreted as a number, the Number() method returns a value of NaN (not a number). What this means is that you can't turn this particular string into a number.