What are JavaScript functions?
Functions are blocks of code designed to perform specific tasks. Functions have one major advantage which is code reuse. This ensures that you write some blocks of code once and use it several times in your program.
In some programming languages like Java,Functions are known as Methods.