First, a function in Javascript is defined as set of statements that perform a task or calculate a value but the procedure must accept some form of input and return an output as a result of the input. The return output is needed to help define that there is an obvious relationship between in the input and output, and it must be defined somewhere too. A function must be named and a list of parameters about the function must be included in the parentheses and separated by commas, while also being enclosed in curly brackets. An example of a function is:
function square(number) {
return number * number;
}
That is one example of many different functions you can create in Javascript, but this an example of limitless possibilities of functions you can create for your site or app or anything you need JavaScript.