El mètode Number.parseFloat()
interpreta el string passat com a argument i retorna un nombre de punt flotant. Aquest mètode es comporta de la mateixa manera que la funció global parseFloat()
i és part del ECMAScript 6 (el seu motiu d'existència és la modularització dels globals).
Sintaxi
Number.parseFloat(string)
Paràmetres
string
- Un string que representa el valor a interpretar.
Descripció
Vegeu parseFloat()
per a més detalls i exemples.
Polyfill
Number.parseFloat = parseFloat;
Especificacions
Especificació | Estat | Comentaris |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Number.parseFloat' in that specification. |
Standard | Definició inicial. |
Compatibilitat amb navegadors
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Suport bàsic | (Yes) | 25 (25) | No support | (Yes) | No support |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Suport bàsic | No support | No support | 25.0 (25) | No support | No support | No support |
Vegeu també
- L'objecte
Number
al que pertany. - La funció global
parseFloat()
.