Name
Function — a JavaScript function
Availability
Core JavaScript 1.0; enhanced in JavaScript 1.1 and 1.2
Synopsis
// Function definition statement function functionname(argument_name_list) { body } // Unnamed function literal; JavaScript 1.2 function (argument_name_list ) { body} // Function invocation functionname(argument _value_list)
Constructor
// JavaScript 1.1 and later new Function(argument_names,
body
)
Properties
- arguments[]
Arguments passed to a function. JavaScript 1.0; ECMA-262; deprecated in favor of the Arguments object.
- arity
The number of declared arguments. Navigator 4, with
LANGUAGE="JavaScript1.2"
.- caller
The function that called this one.
- length
The number of declared arguments. JavaScript 1.1; ECMA-262.
- prototype
The prototype for a class of objects. JavaScript 1.1.
Methods
- apply(thisobj, args)
Invoke a function as a method of an object. Navigator 4.
- toString()
Convert a function to a string. JavaScript 1.0; ECMA-262.
Get Webmaster in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.