Functions:
Functions are blocks of code that perform related tasks.
Functions have a header and a body. Parentheses of the function header
may contain zero or more parameters.
Creating functions:
Creating a function is called defining a function.
The function itself is referred to as the function definition.
Calling functions:
Call a function by writing the name of the function, followed by parentheses, followed by a semicolon.
Do not write the keyword function when you call a function.
Return values:
Use the return keyword followed by an expression to return a value from a function.
Use the assignment operator to assign the return value of your function call to a variable.
Scope:
Variables can have global or local scope. Global variables are visible throughout your code,
local variables are visible only inside the function where they were declared.
You must use the var keyword to declare local variables, otherwise they will be global.
If you try to access a variable that is not "visible", you will get an error.
Passing parameters:
If a function has parameters, include them inside the parentheses of your function call.
Primitive data types are passed by value - meaning the function has its own place in memory
for that variable, and does not have access the place in memory for the original variable,
and thus cannot change the value of the original variable.
Arrays and objects are passed by reference - meaning the function has access to the place in memory
for the original object, and could change the value of the original object.