nodejs function argument as array { name: value } code example
Example 1: how to access any argument in javascript
function example() {
console.log(arguments);
console.log(arguments[0]);
} // Console outputs an array of each argument with its value
example('hi', 'hello');
// Outputs:
// ['hi', 'hello']
// 'hi'
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