Functions

One of the strengths of JavaScript is that it provides support for functions, which is uncommon among scripting languages. On the other hand, JavaScript functions are not as fully developed as those found in languages like C and C++. The functionality that JavaScript does provide through its functions is more than enough to make Web pages come alive.

Syntax

The syntax of JavaScript functions is very straightforward. All function declaration must begin with the keyword function followed by the name of the function. The name of the function is the name that will be used to call on the function within code. Parentheses are placed after the function name to hold arguments that are to be passed into the function. If more than one argument ...

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.