SPS Home    >   Dgreath    >   JavaScript    >   Functions

JAVASCRIPT FUNCTIONS

The following information describes JavaScript's top level function implementation.

THE BOOLEAN TOP LEVEL FUNCTION

Boolean() returns a Boolean true value if the argument is either a number, string, or object. It returns false for anything else.
Example:
Where a = some number, string, or object then x = true:
var x = Boolean(a);

THE DATE TOP LEVEL FUNCTION

Date() returns today's date as a string.
Example:
Returns into x a string in general form Sat Dec 09 13:34:33 2006
var x = Date();

THE NUMBER TOP LEVEL FUNCTION

Number() returns a number from a numeric literal.
Example:
Where a = some numeric literal and x = is the numerical form of a:
var x = Number(a);

THE OBJECT TOP LEVEL FUNCTION

Object() returns a simple object of the argument's type.
Example:
Where a = a Boolean value, or a numeric or string literal and x = is the resultant object of a:
var x = Object(a);

THE STRING TOP LEVEL FUNCTION

String() returns a string object from anything in the argument.
Example:
Where a = something and x = is the string representation of a:
var x = String(a);