Chapter 3 DynaScript Predefined Objects


Number methods

The Number object has these methods:

toString method

Syntax

Number.toString( [radix] )

Description

Returns a string representation of the Number object. A radix may be used if you wish to work with something other than base 10.

Return

String.

Example

This example creates a number object and converts the value to a string:

<!--SCRIPT 
num = new Number( 16 );
stringNum = num.toString();
document.WriteLn( stringNum );
-->

valueOf method

Syntax

Number.valueOf( )

Description

Extracts the number value of the number object as an integer.

Return

Integer.

Example

This example creates a number object, and then converts it back to an integer, which is held in the variable intNum .

<!--SCRIPT 
num = new Number( 16 );
intNum = num.valueOf();
document.WriteLn( intNum );
-->

 


Copyright © 1999 Sybase, Inc. All rights reserved.