contents   index   previous   next

Function Object


The Function object is one of three ways to define and use objects in ScriptEase. The three ways to work with objects are:


Use the function keyword and define a function in a normal way:
function myFunc(x) {return x + 4;}

Construct a new Function object:
var myFunc = new Function("x", "return x + 4;");

Define and assign a function literal:
var myFunc = function(x) {return x + 4;}


All three of three of these ways of defining and using functions produce the same result, x + 4. The differences are in definition and use of functions. Each way has a strength that is very powerful in some circumstances, power that allows elegance in programming. The methods and discussion in this segment on the Function object deal with the second way shown above, the construction of a new Function object.


Function object instance methods