A function in JavaScript is a way for a person to organize the codes they have created, maintain them, or even reuse them. The functions are putting together statements. Those statements show the relationship between input and output. The functions all have parentheses. brackets, a name, they also are passed zero or more pieces of information, and sometimes turn a value. The calling function is when we call the function we named. To pass a function argument means passing the value to the function. The purpose of the return keyword is to return data back to the called function we started with.
An example of all of this is:
function myFunction(a, b) {
return a * b;
}
I think…I hope I explained this well. This has been the most difficult part of this course for me. Well along with the Exams.
Hi Isel, I thought you explained what a function is very well and I agree that the functions are a very difficult part of the course. Practicing JavaScript seems to be the best way to learn the functions and how to code right rather than studying because when writing code there seems to be a logical flow when writing it, like in the functions you mentioned above, when you put a and b together the function then gives you the result of the two pieces of data put together.