number

number

> Functions

Converts a value to a number. If the value is a string, the number function will try to convert it to a number, if the value is already a number, the function returns the number, and for any other type, it returns 0.

Parameters
Return
Examples

number("12345") // 12345 number("3.14159") // 3.14159 number("hello") // 0

See as well