A function is a block of code which can be called from any point in a script after it has been declared. It is good programming practice to use functions to modularize your code and to better provide reuse. This article explains benefits of using functions in JavaScript.