Name
Function: a JavaScript function — ECMAScript v1: Object → Function
Synopsis
functionfunctionname(argument_name_list) // Function definition statement {body} function (argument_name_list) {body} // Unnamed function literalfunctionname(argument_value_list) // Function invocation
Constructor
new
Function(argument_names...,
body)
Arguments
-
argument_names... Any number of string arguments, each naming one or more arguments of the Function object being created.
-
body A string that specifies the body of the function. It may contain any number of JavaScript statements, separated with semicolons, and may refer to any of the argument names specified by previous arguments to the constructor.
Returns
A newly created Function object. Invoking the function
executes the JavaScript code specified by
body.
Throws
- SyntaxError
Indicates that there was a JavaScript syntax error in the
bodyargument or in one of theargument_namesarguments.
Properties
-
arguments[] An array of arguments that were passed to the function. Deprecated.
-
caller A reference to the Function object that invoked this one, or
nullif the function was invoked from top-level code. Deprecated.-
length The number of named arguments specified when the function was declared.
-
prototype An object which, for a constructor function, defines properties and methods shared by all objects created with that constructor function.
Methods
-
apply( ) Invokes a function as a method of a specified object, passing a specified array of arguments.
-
call( ) Invokes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access