contents   index   previous   next

Global object


The properties and methods of the global object may be thought of as global variables and functions. The object identifier global is not required when invoking a global method or function. Indeed, the object name generally is not used. For example, the following two if statements are identical, but the first one illustrates how global functions are usually invoked.


if (defined(name))

   Screen.writeln("name is defined");


if (global.defined(name))

   Screen.writeln("name is defined");


The following two lines of code are also equivalent.


var aString = ToString(123)

var aString = global.ToString(123)


Remember, global variables are members of the global object. To access global properties, you do not need to use an object name. The exception to this rule occurs when you are in a function that has a local variable with the same name as a global variable. In such a case, you must use the global keyword to reference the global variable.


Most of the global methods, functions, described in this section are defined in the ECMAScript standards. A few are unique additions to ScriptEase. In other words, they are not part of the ECMAScript standard, but they are useful. Avoid using the unique functions in a script if it will be used with a JavaScript interpreter that does not support these few unique functions.


Conversion or casting

global object methods/functions