num.parse()

num.parse(s) converts the string s to a number by parsing it as a base-10 floating point number.

Returns

  • if s is a number, returns the number unchanged.

  • if s is a string, attempts to parse it as a base-10 floating point number. Returns the parsed number on success, or null if the string cannot be parsed.

  • if s is any other type, returns null.

Last updated

Was this helpful?