define function in javascript

JavaScript
/* Declare function */
function myFunc(param) {
  // Statements 
}A function is a reusable block of code that allows you to 
input specific values. To specify the values you need to call
the function by typing the name along with the desired values
spaced by commas.

function myFunction(value1, value2) {
	return value1 + value2;
}

myFunction(10, 5);




Now the function will return 15.
Source

Also in JavaScript: