← BYTES
JavaScript·Intermediate·Ref: 3.2.7
What does the `...rest` parameter do in a function signature, e.g. `function f(a, ...rest) {}`?
Have a question about this video? Mention reference 3.2.7 when you contact us.
a.Spreads the function's own arguments out as separate global variables
b.Collects all remaining arguments beyond the named ones into a real array
c.Only works with exactly zero extra arguments
d.Is identical to the old `arguments` object in every respect
A rest parameter gathers every argument not already captured by earlier named parameters into a genuine Array (unlike the older `arguments` object, which is merely array-like), making it directly usable with array methods like map/filter.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES327#JavaScript