Number.parseFloat()
El método Number.parseFloat()
parsea un argumento cadena y regresa un número de punto flotante. Este método se comporta de igual forma a la función global parseFloat()
y es parte de ECMAScript 2015 (su propósito es la modularización de los globales).
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Sintaxis
Number.parseFloat(string)
Parámetros
string
- The value to parse. If this argument is not a string, then it is converted to one
using the
ToString
abstract operation. Leading whitespace in this argument is ignored.
Valor de regreso
A floating point number parsed from the given string
.
Or NaN
when the first non-whitespace character cannot be converted to a
number.
Descripción
Por favor ver parseFloat()
para más detalles y ejemplos.
Polyfill
if (Number.parseFloat === void 0) {
Number.parseFloat = parseFloat;
}
Especificaciones
Especificación | Estatus | Comentario |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) La definición de 'Number.parseFloat' en esta especificación. |
Standard | Definición inicial |
ECMAScript (ECMA-262) La definición de 'Number.parseFloat' en esta especificación. |
Living Standard |
Compatibilidad del navegador
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Ver también
- El objeto
Number
al que pertenece. - El método global
parseFloat()
.