What is Function in JavaScript ?
Function is some set of statements which executes when it is called and perform a task. We can call them again and again in the program when we require.or
Function is a named block which can be reused when we require it.So, we can say that it is reusability of code.Types of function:
Built-in functions
Functions which are already defined in the JavaScript language.Pre-defined functions
or
Ready-made functionsUser-defined functions
Functions which are defined by the user are called user-defined functions.Types of user defined function
1. Function with no arguments and no return value2. Function with no arguments and return value
3. Function with arguments but no return value
4. Function with arguments and return value.