javascript give type to argument code example

Example 1: parameters types in javascript

/**
 * My function description
 * @param {String} a
 * @param {String} b
 * @param {Number} amount
 * @example
 * // returns "fooBar fooBar"
 * myFunction('foo', 'Bar', 2)
 * @returns {String}
 */
function myFunction(a, b, amount){
  //do stuff
}
//Note that javascript is not a statically typed language and therefore you
//will not recieve any syntax errors for passing in the wrong types.
//The above code works in Visual Studio Code and intellisense.

Example 2: 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