Functions have a specific structure that allows the
compiler to recognize them:
command word: function
user-defined name (note, you can have
unnamed functions in JavaScript, but in this class, we'll stick
with explicitly named functions)
paramenters--surrounded by parentheses:
(par1, par2)
start and end notation indicated by
squiggly brackets: { }
result or return.
a function can have zero to infinity parameters,
but you should only use the parameter that are really
needed for the function to work--info that you need to
pass from another source
functions may include an explicit return
statement or simply perform a task that is the result of the function
functions need to be called to be used. There are
2 main ways to call a function: