Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Number.parseInvariant Function

Returns a numeric value from a string representation of a number. This function is static and can be called without creating an instance of the object.

Syntax

var numberVar = Number.parseInvariant(value);

Arguments

Term

Definition

value

A string that represents a whole or floating-point number.

Returns

A floating-point representation of value, if value represents a number; otherwise, NaN Property (Global) (not a number).

Remarks

Use the parseInvariant function to create a numeric value from a string representation of a number. The value argument can contain a decimal point and the "+" and "-" characters to indicate positive and negative, respectively.

The parseInvariant function provides consistent parsing across all types and should be used instead of the similar ECMAScript (JavaScript) parseInt Method (JScript 5.6) method.

Example

The following example shows how to use the parseInvariant function to create a numeric value from a string representation of a number.

JavaScript

var a = Number.parseInvariant("4");
var b = new Number(2);
var c = Number.parseInvariant("1.53") + a + b;
// View the results: "7.53"
alert(c);