How to create a function in javascript

JavaScript
// Code by DiamondGolurk
// Defining the function

function test(arg1,arg2,arg3) {
	// Insert code here.
  	// Example code.
  	console.log(arg1 + ', ' + arg2 + ', ' + arg3)
}

// Running the function

test('abc','123','xyz');

// Output
// abc, 123, xyz/* Declare function */
function myFunc(param) {
  // Statements 
}function myFunction(var1, var2) {
  return var1 * var2;
}function addfunc(a, b) {
  return a + b;
  // standard long function
}

addfunc = (a, b) => { return a + b; }
// cleaner faster way creating functions!
function myFunc(param) {
  return param
}
console.log(myFunc("Hello World"))// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
// FUNCTION DECLARATION (invoking can be done before declaration)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
function calcAge1(birthYear) {
   return 2037 - birthYear;
}
const age1 = calcAge1(1991);

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
// FUNCTION EXPRESSION (invoking canNOT be done before declaration)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
const calcAge2 = function (birthYear) {
   return 2037 - birthYear;
}
const age2 = calcAge2(1991);

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
// ARROW FUNCTION (generally used for one-liner functions)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
const calcAge3 = birthYear => 2037 - birthYear;
const age3 = calcAge3(1991);
console.log(age3);
Source

Also in JavaScript: