Let's take a closer look at the process. A function is a stand-alone set of instructions, like a tiny program, that can be invoked or "called" from any other code, as required. Functions are a fundamental part of any computer programming language. To understand why functions are so useful, let's make up an example.
Suppose you ran a web site that sold 500 products and that you had a page for each product description. At the bottom of each of those 500 pages you printed a mailing address for people who don't like buying things online. The source code for that portion of the page might look like this...
If functions were available in HTML, you could create a function that printed the bolded section, above, and then replace the bottom of those 500 pages (for the last time) with something like this...
<-- Back to Home Page