Number.parseFloat()
Number.parseFloat() 静态方法解析参数并返回浮点数。如果无法从参数中解析数字,则返回 NaN。
¥The Number.parseFloat() static method parses an argument and returns a floating point number. If a number cannot be parsed from the argument, it returns NaN.
Try it
语法
参数
返回值
示例
Number.parseFloat 与 parseFloat
¥Number.parseFloat vs. parseFloat
该方法与全局 parseFloat() 函数具有相同的功能:
¥This method has the same functionality as the global parseFloat() function:
js
Number.parseFloat === parseFloat; // true
其目的是全局变量的模块化。
¥Its purpose is modularization of globals.
有关更多详细信息和示例,请参阅 parseFloat()。
¥See parseFloat() for more detail and examples.
规范
| Specification |
|---|
| ECMAScript Language Specification # sec-number.parsefloat |
浏览器兼容性
BCD tables only load in the browser