This string is called query parameters and can be used to send additional information to the server. const foo = (first, second,...args) => console.log(first, second, args) foo('A', 'B', 'C', 'D') // Output: A B ['C', 'D'] JavaScript allows you to destruct rest parameters, which means that you can unpack rest variable data into a distinct variable name. As well as the rest parameter must be positioned last in the function parameters list. The rest parameter allows us to represent an indefinite number of arguments as an array. Rest parameters are real arrays; the arguments object is not. Das arguments Objekt ist kein echtes Array, während Rest Parameter eine Array sind, was bedeutet, dass Methoden wie sort, map, forEach oder pop direkt angewendet werden können. Rest parameter in a function declaration has ... (three dots) prefixed to it. parameter into an array. Passing arguments to a JavaScript function is quite common. In this example, the first argument is mapped to a and the second to Then the rest parameter ...numbers receives the rest of the arguments. For better understanding what rest parameter is, let’s start from the beginning. Javascript Rest parameter syntax can be used in function declarations to compress passed arguments to an array. Syntax function f(a, b, ...theArgs) { // ... } Beschreibung . Spread syntax "expands" an array into its elements, while rest syntax collects multiple elements and "condenses" them into a single element. Rest parameters. The “rest” parameters pass and handle an arbitrary number of arguments. JavaScript arguments are passed by value: The function only gets to know the values, not the argument's locations. const foo = (first, second,... args) => console. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. TypeError: Reduce of empty array with no initial value, X.prototype.y called on incompatible type, TypeError: can't access property "x" of "y", TypeError: can't assign to property "x" on "y": not an object, TypeError: can't define property "x": "obj" is not extensible, TypeError: can't delete non-configurable array element, TypeError: can't redefine non-configurable property "x", TypeError: cannot use 'in' operator to search for 'x' in 'y', TypeError: invalid 'instanceof' operand 'x', TypeError: invalid Array.prototype.sort argument, TypeError: invalid assignment to const "x", TypeError: property "x" is non-configurable and can't be deleted, TypeError: setting getter-only property "x", TypeError: variable "x" redeclares argument, Warning: -file- is being assigned a //# sourceMappingURL, but already has one, Warning: 08/09 is not a legal ECMA-262 octal constant, Warning: Date.prototype.toLocaleFormat is deprecated, Warning: JavaScript 1.6's for-each-in loops are deprecated, Warning: String.x is deprecated; use String.prototype.x instead, Warning: expression closures are deprecated, Warning: unreachable code after return statement, Enumerability und Ownership von Eigenschaften, Rest Parameter sind nur die jenigen, die zu einem Namen gehören (z. Here is another Javascript REST API Call with authentication using json: