Function() (capital F) : Function Object : Function JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Function » Function Object »

 

Function() (capital F)












Syntax








var variable = new Function()
    var variable = new Function(int)
    var variable = new Function(arg1, ..., argN)



Function() is a constructor that creates a Function object.

Properties and Methods of the Function Object







































Property/Method Description
apply() Applies method to multiple objects
arguments Array reflecting function arguments
arity Number of arguments expected by function
call() Allows calling of methods belonging to other functions
caller Reference to function caller
prototype Prototype for a class of objects
toSource() Created copy of function object
toString() Converts function back to string which defines it




The following example sets the Background Color with a New Function Object












<html>
    <script language="JavaScript">
    <!--
    // Create a function to change background color
    var setBGColor = new Function(document.bgColor='blue');
    -->
    </script>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Function
» Function Object