Is it possible to send a variable number of arguments to a JavaScript function?
Update: Since ES6, you can simply use the spread syntax when calling the function: func(…arr); Since ES6 also if you expect to treat your arguments as an array, you can also use the spread syntax in the parameter list, for example: function func(…args) { args.forEach(arg => console.log(arg)) } const values = [‘a’, ‘b’, ‘c’] func(…values) … Read more