Languages
[Edit]
EN

JavaScript - pass array as function argument

0 points
Created by:
Giles-Whittaker
739

In this article, we would like to show you how to pass array as function argument using JavaScript.

Quick solution:

Note:

The spread operator (...) was introduced in ES6.

 

Practical example

Edit

In this example, we present a solution that doesn't use the spread operator and works with older browsers.

 

References

Edit
  1. Spread syntax (...) - JavaScript | MDN
  2. Function.prototype.apply() - JavaScript | MDN

Alternative titles

  1. JavaScript - pass array as function parameter
  2. JavaScript - convert array to function arguments list
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join