URLSearchParams: size property
The size property is the number of parameters in the list.
Value
A number, a count.
- Read-only. Assigning to it throws
TypeError. - Parameters with the same name are counted separately:
sizeofa=1&b=2&a=3is 3. - No event notifies when the list changes: only the App's own code can change it.
Examples
js
const q = new URLSearchParams('a=1&b=2&a=3');
console.log(q.size);Result: logs 3.
Differences from the web
Same as the web.
See also
getAll(): all values with the name