把传递的参数转换成数字
把传递的参数转换成数字,如果传递的首位不是数字,返回null
语法:
Number.from(arg);
参数:
- arg - (mixed) 要转换为数字的参数。
返回值:
- (number) 参数转换的数字。
- (null) 如果不能转换,则返回null。
举例:
Number.from('12') // 返回 12
Number.from('hello') // 返回 null
把传递的参数转换成数字,如果传递的首位不是数字,返回null
语法:
Number.from(arg);
参数:
返回值:
举例:
Number.from('12') // 返回 12
Number.from('hello') // 返回 null