javascript function with array 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 var x = [ 'p0', 'p1', 'p2' ];
call_me(x);
function call_me(params) {
for (i=0; i<params.length; i++) {
alert(params[i])
}
}const args = ['test0','test1','test2'];
function call_me(param1, param2, param3){
//
}
call_me.apply(this, args);
Also in JavaScript:
- how set defualt image for dropify
- angular google maps
- learn json
- port 3000 is already in use nodemon app crashed
- form taglib in jsp
- get localstorage
- pa mmj portal
- disable radio button javascript
- use ngfor to make a dropdown in angular from array
- refresh page and run function after javascript
- print to console without newline nodejs
- js split array into smaller arrays
- .net mvc javascript function call link
- javascript date difference in months
- mongoose query with function(req, res, next)
- route in component react
- how to run mocha tests on asynchronous functions in script
- js check if radio button is checked
- next js protected routes
- react window navigate
- javascript remove object property
- based on scroll position and get data attribute javascript
- how to get csrf token in javascript
- serverless and connections mongodb atlas