Class Function

The Function class represent a JavaScript function.

PropertyDescription
length: NumberThe number of named arguments that were specified when the function was declared.
prototype: ObjectAn object that defines properties and methods shared by all objects created with that constructor function.
ConstructorDescription
Function(String...)Constructs the function with the specified arguments where the last argument represents the function body and all preceeding arguments represent the function parameters.
MethodDescription
apply(Object, Array)Invokes this function as a method of the specified object passing the specified Array of arguments.
call(Object, Object...)Invokes this function as a method of the specified object passing the specified optional arguments.
toString()Returns a String representation of this function object.

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

length: Number

The number of named arguments that were specified when the function was declared.


prototype: Object

An object that defines properties and methods shared by all objects created with that constructor function.


Function(args: String...)

Constructs the function with the specified arguments where the last argument represents the function body and all preceeding arguments represent the function parameters.

Parameters:

  • args - one or more Strings where the last argument in the list represents the function body and all preceeding arguments represent the function parameters.

apply(thisobj: Object, args: Array): Object

Invokes this function as a method of the specified object passing the specified Array of arguments.

Parameters:

  • thisobj - the object to which the function is applied.
  • args - Array of values or an arguments object to be passed as arguments to the function.

Returns:

  • whatever value is returned by the invocation of the function.

call(thisobj: Object, args: Object...): Object

Invokes this function as a method of the specified object passing the specified optional arguments.

Parameters:

  • thisobj - the object to which the function is applied.
  • args - an optional list of one or more arguments values that are passed as arguments to the function.

Returns:

  • whatever value is returned by the invocation of the function.

toString(): String

Returns a String representation of this function object.

Returns:

  • a String representation of this function object.