call function arguments javascript code example

Example 1: js array as parameter

function myFunction(a, b, c) {//number of parameters should match number of items in your array
  	//simple use example
  	console.log("a: " + a);
  	console.log("b: " + b);
  	console.log("c: " + c);
}

var myArray = [1, -3, "Hello"];//define your array
myFunction.apply(this, myArray);//call function

Example 2: js running function as parameter

function FuncOne(param1) //example function
{
  //Do whatever
}

function FuncTwo(FuncOne, param1) //Function to call FuncOne w/ param
{
  FuncOne(param1); //Write it like you would any normal function call
}