Often, a particular piece of code needs to be repeated several times within a web page or application. Functions make it easy to reuse code.