JS Built-ins
Functionlengthintermediate

Function.length β€” rest parameters not counted

πŸ“– Usage Example
const arrow = (a, b) => a + b
arrow.length  // β†’ 2

Arrow functions also have a length property reflecting their parameter count.

fn.length β€” rest params excluded

Rest parameters (...args) are never counted in fn.length. A function with only a rest parameter has length === 0.

Challenge: Verify that ((...args) => {}).length === 0.

πŸ’‘ Hints (1)
  • β€’ Rest parameters (`...args`) are excluded from `fn.length`.