Here's a simple page that uses a predefined square-root function. Here's a reference to predefined functions (look under JavaScript Math Objects and Javascript Global Properties and Functions for the most common functions).
Dave Reed has created a library of useful random functions. Here is one example that uses the random functions. Here's a link to these functions.
Functions that are called as part of an expression should have a return value. Functions that are called by a user event (button press) should not have a return value. A more comprehensive reference to functions can be found online.
Function concepts and terms you should know: