Udostępnij za pośrednictwem


Number Type Extensions

Extends the base ECMAScript (JavaScript) Number functionality with static and instance methods.

Namespace: None. This type extension is global and not part of a namespace.

Inherits: None

var numberVar = Number.parseInvariant("4");

Member Extensions

Name

Description

Number.format Function

Formats a number by using the invariant culture.

Number.localeFormat Function

Formats a number by using the current culture.

Number.parseInvariant Function

Returns a numeric value from a string representation of a number.

Number.parseLocale Function

Creates a number from a locale-specific string.

Remarks

Number extensions are part of the Microsoft Ajax Library. They add functionality to the JavaScript Number object and provide members that are more familiar to .NET programmers.

For more information about the JavaScript object that this type extends and about its constructor, see JScript Number Object in the Language Reference.

Example

The following example shows how to call the ASP.NET AJAX parseInvariant extension function to create a number from the string representation of a number.

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); 

See Also

Reference

Number Object

new Operator

Number Type Functions

Other Resources

Language Reference