Parameters

A missing argument is undefined unless its parameter has a default (qty = 1), evaluated at call time. A rest parameter (...extras, always last) gathers the remaining arguments into a real array, and a parameter can destructure an object (Object Destructuring). Arguments are passed by value, but an object's value is a reference: a function can mutate the object, while reassigning the parameter only rebinds its local name.

Default, rest and destructured parameters; mutating versus rebindingJavaScriptLive
function order(item, qty = 1, ...extras) { return `${qty} ${item} [${extras}]`; }
const connect = ({ host, port = 443 } = {}) => `${host}:${port}`;   // destructured
function change(n, obj1, obj2) {
  n *= 10;                        // local copy of a primitive
  obj1.item = "changed";          // mutates the shared object
  obj2 = { item: "changed" };     // rebinds the local name only
}
const num = 10, a = { item: "unchanged" }, b = { item: "unchanged" };
change(num, a, b);
console.log(order("tea"), "|", order("coffee", 2, "milk", "sugar"), "|", connect({ host: "x.io" }));
console.log(num, a.item, b.item, order.length);

length counts parameters before the first default or rest parameter. Beyond three parameters, prefer one destructured options object.