So you’ve written a lot of small programs till now, like the one where you found out the even numbers between 0-1000 and many more. Now as you know that these programs perform a specific operation, wouldn’t it be better if they were given a name of the function that they perform. Watch the next video to learn about what functions are.
Well isn’t that interesting that the program which performs a certain predefined action (function) is declared with the keyword function in JavaScript? Let’s understand more about functions in detail.
So the inputs that are provided to the function are known as parameters, which take in arguments and a function may or may not return a value. After a return statement is encountered, the control goes back to the caller function. So the code written below the return statement won’t be executed.
A function declaration is made up of four components: