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
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.
๐ŸŒ
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 ...
๐ŸŒ
Medium
medium.com โ€บ @pratyushpavanchoudhary โ€บ js-spread-operator-4423577f06a2
js spread (...) operator - by Pratyush Pavan
August 26, 2024 - The spread operator allows you ... When a function expects multiple arguments, you can use the spread operator to pass elements of an array as individual arguments....
๐ŸŒ
JavaScript.info
javascript.info โ€บ tutorial โ€บ the javascript language โ€บ advanced working with functions
Rest parameters and spread syntax
October 18, 2022 - When ... occurs in a function call or alike, itโ€™s called a โ€œspread syntaxโ€ and expands an array into a list. ... Rest parameters are used to create functions that accept any number of arguments.
Find elsewhere
๐ŸŒ
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)....
๐ŸŒ
Hexlet
hexlet.io โ€บ courses โ€บ js-functions โ€บ lessons โ€บ spread-operator โ€บ theory_unit
Spread syntax (unpacking arguments) | JS: Functions - Hexlet
April 29, 2025 - The spread statement in function calls is syntactically identical to the rest statement in definitions, but does the opposite. Let's take the sum() function as an example: const sum = (...numbers) => { let result = 0; for (let num of numbers) { result += num; } return result; }; Let's call sum() by applying the spread statement to an array of 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.
๐ŸŒ
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.
๐ŸŒ
Vojtechruzicka
vojtechruzicka.com โ€บ spread-javascript
Javascript spread operator and rest parameters (...) | Vojtech Ruzicka's Programming Blog
January 30, 2019 - The first parameter of the apply function is what's supposed to be the value of "this". The second one is the array we want to pass into the function as arguments. With spread operator, you can achieve the same using:
๐ŸŒ
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 ...
๐ŸŒ
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
๐ŸŒ
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 an iterable object. The rest parameter (...) packs the elements into an array. The rest parameters must be the last arguments of a function.
๐ŸŒ
David Walsh
davidwalsh.name โ€บ spread-operator
6 Great Uses of the Spread Operator
February 1, 2017 - Thanks to ES6 and the likes of ... like JSX. 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 a ...
๐ŸŒ
CodeShack
codeshack.io โ€บ home โ€บ references โ€บ javascript โ€บ ...
JavaScript Spread (...) Operator: Syntax & Examples
June 23, 2026 - [...a, ...b] merges arrays; {...obj} copies an object; Math.max(...nums) passes array items as arguments. The same ... syntax in a function parameter is the rest operator, which gathers arguments into an array.
๐ŸŒ
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....