Hello everyone,
Function within JavaScript helps us perform different tasks easier, faster, and allows us to reuse them in other programs. This is beneficial for us because we can better maintain the code we are working with; it also helps us reduce the amount of duplicate code that may arise if we did not use function. It’s also important to remember that functions pass zero or more pieces of information with each function.
Calling on a function in JavaScript essentially does the processing for you, they will run actions you have set within the function. This can be done by setting up an action then executing the program. Some other things you can do with function is pass them from one program to another program. When you pass an argument, you are passing information from one program to another. Arguments are the pieces of information that are passed from the calling program to the main program which will then be used. Finally, the purpose of the return keyword within a function is to return whatever expression is back into the variable. That will be the “answer” to what the function calculated. The return function also ends the function, nothing will happen after that.
Hey Lyzannette,
Functions are like procedures, they are set of statements that performs a task or calculates a value.
Your post was really insightful and helped me understand more about functions.