JS Built-ins
Functionlengthbeginner

Function.length β€” zero parameters

πŸ“– Usage Example
function fn(a, b = 1) {}
fn.length  // β†’ 1 (default params not counted)

Parameters with default values are not counted in Function.length.

fn.length β€” no parameters

A function with no parameters has a length of 0.

Challenge: Verify that function g() {} has g.length === 0.

πŸ’‘ Hints (1)
  • β€’ A function with no declared parameters has `length` of `0`.