contents   index   previous   next



global.defined()

syntax:

defined(value)

where:

value - a value or variable to check to see if it is defined.

 

return:

boolean - true if the value has been defined, else false

 

description:

This function tests whether a variable, object property, or value has been defined. The function returns true if a value has been defined, or else returns false. The function defined() may be used during script execution and during preprocessing. When used in preprocessing with the directive #if, the function defined() is similar to the directive #ifdef, but is more powerful. The following fragment illustrates three uses of defined().

 

see:

global.undefine(), in operator, undefined

 

example:

var t = 1;

#if defined(_WIN32_)

   Screen.writeln("in Win32");

   if (defined(t))

      Screen.writeln("t is defined");

   if (!defined(t.t))

      Screen.writeln("t.t is not defined");

#endif

 

// The first use of defined() checks whether a value

// is available to the preprocessor

// to determine which platform is running the script.

// The second use checks a variable "t".

// The third use checks an object "t.t"

 


global.escape()