Converting Data Types
Functions
parseFloat(str)
- Converts a string to a float; returns
"
NaN" (not a number) if the first character cannot be
converted to a
number
parseInt(str [, radix])
- Converts a string to an integer
(base specified by "radix", defaults to 10); returns "
NaN"
(not a
number) if the first character cannot be converted to a number in the
specified radix.
Number(obj)
- Converts an object to a number
String(obj)
- Converts an object to a string
- Same as
obj.toString()
- The output is of the form
[object MyObject]
charCodeAt(index)
- Converts the specified string character to a numeric Unicode value
String.fromCharCode(num, ...)
- Converts one or more numeric Unicode values into a string