Chapter 3 DynaScript Predefined Objects


Boolean object

Object

Allows you to create an object with a value of true or false. The Boolean object has no properties.

Standard: ECMAScript

Syntax

Boolean.MethodName( parameter ) 

Description

You can set the Boolean object's value when you create the object, or at a later date. To create a Boolean object, use this constructor:

BoolObj = new Boolean ( [value] );

If you provide a value, the Boolean object contains that initial value. If you do not provide a value, the object has the value of false.

Example

This example creates a Boolean object and sets the value as false:

<!--SCRIPT 
  myBool = new Boolean( false );
  document.WriteLn( myBool );
-->

toString method

Syntax

Boolean.toString( )

Description

Returns the value of the Boolean as a string.

Return

String

Example

This example returns the value of the Boolean as a string:

<!--SCRIPT 
    myBool = new Boolean(true);
    document.WriteLn(myBool.toString() );
-->

valueOf method

Syntax

Boolean.valueOf( )

Description

Returns the value of the Boolean object.

Return

Boolean

Example

This example returns the value of the Boolean object:

<!--SCRIPT 
    myBool = new Boolean(true);
    document.WriteLn(myBool.valueOf() );
-->

 


Copyright © 2001 Sybase, Inc. All rights reserved.