reading-notes

View project on GitHub

Functions

what is the function?

a function allows you to define a block of code, give it a name and then execute it as many times as you want.

declaring a function

You can declare a function by providing its return value, name, and the types for its arguments.

function functionName (argument1,argument2,….)

{ statements; }

Invoking afunction

functions are called by specifying the name of the function, followed by the parentheses. The parentheses may or may not contain a list of arguments depending on the function definition.

functionName();