You can also use rest parameters:

function Numbers(...numbers){
    this.numbers = numbers;
}
Answer from madox2 on Stack Overflow
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Reference โ€บ Operators โ€บ Spread_syntax
Spread syntax (...) - JavaScript - MDN Web Docs - Mozilla
May 22, 2026 - The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the properties of an object and adds the key-value ...
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ javascript-spread-and-rest-operators
JavaScript Spread and Rest Operators โ€“ Explained with Code Examples
February 8, 2024 - The spread operator simplifies the process of passing variable-length arguments to functions.
๐ŸŒ
Medium
medium.com โ€บ @rabailzaheer โ€บ unpacking-javascript-spread-operator-and-rest-parameters-advanced-techniques-f73f2fa41cf3
Unpacking JavaScript Spread Operator and Rest Parameters: Advanced Techniques
September 18, 2023 - The spread operator, denoted by ..., allows you to spread the elements of an iterable (e.g., an array or a string) into another iterable, function arguments, or object literals.
๐ŸŒ
Medium
medium.com โ€บ @luke_smaki โ€บ javascript-es6-spread-operator-and-rest-parameters-b3e89d112281
JavaScript ES6: Spread Operator and Rest Parameters | by Luke Ruokaismaki | Medium
August 15, 2018 - Using the rest parameter in the ... spread the value of an array (or any iterable) across zero or more arguments in a function or elements in an array (or any iterable)....
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ How-to-use-Spread-Syntax-with-arguments-in-JavaScript-functions
How to use Spread Syntax with arguments in JavaScript functions?
November 10, 2022 - Its utility in a function call allows us to extract function parameters from an iterable. In this tutorial, we learn how to use Spread Syntax with arguments in JavaScript functions. A Spread operator, denoted with (...) followed by the name of the iterable expands the iterable into its constituent ...
๐ŸŒ
David Walsh
davidwalsh.name โ€บ spread-operator
6 Great Uses of the Spread Operator
February 1, 2017 - I've become a big fan of the spread operator, three dots that may change the way you complete tasks within JavaScript. The following is a listing of my favorite uses of the spread operator within JavaScript! To this point we've called Function.prototype.apply, passing an array of arguments, to call ...
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript-spread-operator
JavaScript Spread Operator | GeeksforGeeks
The spread operator (...) in JavaScript ... It is commonly used in situations where you want to copy or merge arrays, objects, or even pass arguments to functions.1....
Published ย  November 11, 2024
๐ŸŒ
Medium
eleftheriabatsou.medium.com โ€บ javascript-spread-operator-explained-with-examples-a38caf568ffd
JavaScript Spread Operator Explained (with Examples) | by Eleftheria Batsou | Medium
September 30, 2024 - The spread operator (...) is a convenient way to expand elements of an array or object into individual elements. It's often used to make copies of arrays or objects, combine data, or pass multiple arguments to functions.
๐ŸŒ
DEV Community
dev.to โ€บ marinamosti โ€บ understanding-the-spread-operator-in-javascript-485j
Understanding the Spread Operator in JavaScript - DEV Community
September 23, 2019 - Spread syntax allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places ...
๐ŸŒ
CodeShack
codeshack.io โ€บ home โ€บ references โ€บ javascript โ€บ ...
JavaScript Spread (...) Operator: Syntax & Examples
June 23, 2026 - It expands an array, object or iterable into individual elements โ€” for copying, merging, or passing as separate function arguments. ... Same ... syntax, opposite jobs: spread expands a collection into pieces; rest gathers function arguments ...
๐ŸŒ
Flexiple
flexiple.com โ€บ javascript โ€บ javascript-spread-operator
JavaScript Spread Operator - Flexiple
April 17, 2024 - The JavaScript spread operator (...) allows an iterable such as an array or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected.
๐ŸŒ
JavaScript Tutorial
javascripttutorial.net โ€บ home โ€บ javascript array methods โ€บ javascript spread operator
The Practical Usages of JavaScript Spread Operator
May 8, 2024 - The spread operator (...) unpacks the elements of the odd array. Note that ES6 also has the three dots ( ...) which is a rest parameter that collects all remaining arguments of a function into an array.
๐ŸŒ
SitePoint
sitepoint.com โ€บ blog โ€บ javascript โ€บ quick tip: how to use the spread operator in javascript
Quick Tip: How to Use the Spread Operator in JavaScript โ€” SitePoint
November 7, 2024 - This can be particularly useful when you have an array of values that you want to pass to a function as separate arguments. The spread operator only performs a shallow copy, which means it only copies the top-level elements or properties. If an array or object contains other arrays or objects, those are copied by reference, not by value. This means that if you modify the nested arrays or objects, those changes will be reflected in the original array or object. Yes, the spread operator can be used with strings in JavaScript.
๐ŸŒ
Codesmith Enterprise
codesmith.io โ€บ blog โ€บ perfecting-javascripts-spread-rest-and-default-parameters
Codesmith | Perfecting JavaScript's Spread, Rest, and Default Parameters
TLDR - Perfecting JavaScript's Spread, Rest, and Default Parameters Spread Operator : Expands iterables (arrays, strings, sets) into individual elements for function calls, arrays, or objects.
๐ŸŒ
GitBook
basarat.gitbook.io โ€บ typescript โ€บ future-javascript โ€บ spread-operator
Spread Operator | TypeScript Deep Dive
December 31, 2019 - We've already seen one usage of ... of an array when destructuring. The spread operator allows you to easily place an expanded version of an array into another array....
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ spread-operator-in-function-calls-javascript
Spread operator in function calls JavaScript
The spread operator in function calls enhances the function parameter handling. The spread operator allows you to expand an array or any iterable across zero or more arguments in a function call.