JS Built-ins
URLSearchParamsbeginner

URLSearchParams#get() β€” returns value for key

πŸ“– Usage Example
const p = new URLSearchParams('a=1')
p.get('a')   // β†’ '1'
p.get('z')   // β†’ null

get() retrieves the first value for a key, or null if the key doesn't exist.

URLSearchParams#get()

params.get(name) returns the first value associated with the given key, or null if not present.

Challenge: Use get() to retrieve a value from params.

πŸ’‘ Hints (1)
  • β€’ get() only returns the first value if a key appears multiple times