function

JavaScript 1.0+, ECMAScript 1.0+, JScript 1.0+ Nav2+, NES2+, IE 3+, Opera3+ Syntax

function name(parm1, parm2, …, paramN)

function name()

Description

The function keyword is used for specifying JavaScript functions. Javascript functions typically contain a series of JavaScript statements that are grouped together to perform a specific task. The name is the name of the function and parm1 through paramN are any optional parameters.

Example

Listing 6.123 shows how the function keyword is used. The function keyword defines the sendMessage function.

Listing 6.123 Example of function Keyword
 <html> <script lanuguage="JavaScript"> <!–– Hide function sendMessage(){ alert("The function key word is used to declare the sendMessage ...

Get Pure JavaScript 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.