Safely get a search (query) parameter
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string
|
key of location.search value to get |
Returns:
- Type:
-
string
- returns the value of the requested query param
Example
getSearchParam('name'); // returns 'foo' where ?name=foo