Chapter 3 DynaScript Predefined Objects


Number object

Object

Enables you to use methods and obtain properties on a number.

Standard: ECMAScript

Syntax

To use a Number property:

Number.propertyName

To use a Number method:

Number.MethodName( parameter ) 

Description

The Number object represents a number for which you want to use methods and properties made available with the Number object. These methods and properties are not available to numbers that are held by variables ( num = 14 ).

You can call a Number object as a function:

Number( value ); 

or as a constructor:

myNumber = new Number( value );

When called as a function, a type conversion is performed and a number is returned. A new Number object is not created. When a Number object is created through a constructor, a Number object is returned.

The Number object has both a built-in object as well as constructors that allow users to create instances of a Number object. When referring to Number in the syntax sections of this chapter, we are referring to an instance of a Number object, not the built-in Number object.

Example

This example creates a Number object with the value of 32:

<!--SCRIPT 
num = new Number( 32 );
document.WriteLn( num );
-->

 


Copyright © 1999 Sybase, Inc. All rights reserved.