In JavaScript we use functions to complete a task and to maintain our code to make it easier to reuse. To use functions, you will have a function keyword and a function name and parentheses. WIthin the parentheses are the parameters for the functions. When you call a function, it is usually the name of the function you want to call followed by parentheses. Calling a function tells the computer to run the entered code. To pass a function means that the code will run the same reference as before but the values are different. This allows functions to be reused and to keep the code organized and avoid repeating code. The return keyword in functions allows the code to send the data to the called function. When the function reaches the return keyword it will stop and produce the value specified. It is important to note that it does not exit the program only the function.
Leave a Reply
You must be logged in to post a comment.