- This function is used to convert object arguments into numbers, which represent the object value.
- If the specified value cannot be converted into a legal number, NaN is returned.
In some instances, the specified value cannot be converted into a legal number. Then,
NaN is returned instead.
var var1 = false; var var2 = true; var var3 = "123"; var var4 = "123 456"; var num = Number(var1) + "<br>" + Number(var2) + "<br>" + Number(var3) + "<br>" + Number(var4);
Note: In case the parameter happens to be a date object, this function will return the number of milliseconds that have passed from 1970 UTC, January 1st, midnight, to now.
NaN which means that the variable is not a number.
|Return Value:||Returns object values if they can be translated into legal numbers.
Returns NaN if a value cannot be converted into a legal number.
Returns 0 if no argument is provided.