Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

parseFloat

The parseFloat() function of the Global object is used to return a number from a string argument that is a decimal literal.

SyntaxparseFloat( string )

Parameters

String The string to parsed as a floating point number.

Examples

var x = parseFloat( "1.5" ); var y = parseFloat( "2.1em" ); var z = parseFloat( "hello" ); alert( typeof x + " - " + x ); /* number - 1.5 */ alert( typeof y + " - " + y ); /* number - 2.1 */ alert( typeof z + " - " + z ); /* number - NaN */

JavaScript

Methods

addEventListeneralertaveragebackblurconcatcreatedecodeURIdecodeURIComponentencodeURIencodeURIComponentevaleveryfilterforwardgoisArrayisFiniteisNaNjoinparseFloatparseIntpoppushpushStatereducereplaceStatereverseshiftshuffleslicesomesortspliceunshiftwrite