JS Built-ins
URLSearchParamsbeginner

URLSearchParams#size β€” empty params is 0

πŸ“– Usage Example
const p = new URLSearchParams('a=1&b=2')
p.size  // β†’ 2

size returns the total number of key-value pairs in the URLSearchParams object.

URLSearchParams#size

The size property returns the total number of key-value entries.

Challenge: Verify that an empty URLSearchParams has size 0.

πŸ’‘ Hints (1)
  • β€’ size reflects the number of entries, not unique keys