JavaScript: function Operator
Description
The function operator defines a function inside an expression.
Version
Implemented in JavaScript 1.5
Syntax
var1 = function( parameter1, parameter2,......parametern) { statement(s) }
Parameters
parameters: A list of arguments to the function.
statement(s): JavaScript statements.
Example:
The following web document demonstrates the use of function operator. It sets x to a function that returns the square of two numbers.
HTML Code
JS Code
View the example in the browser
Practice the example online
See also
Conditional Operator
comma
delete
in
instanceof
new
this
typeof
void
Previous: JavaScript: delete Operator
Next: JavaScript: in Operator
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics