JavaScripture
Contribute via GitHub Feedback

URLSearchParams : Object

Helper method to manipulate search parameters (such as ?foo=bar) of a url as a set of name/value pairs. Note, each name can have multiple values. See URL.searchParams.

Constructors

new URLSearchParams() : URLSearchParams

Constructs a new URLSearchParams.

Example:

Run

Results:

 

new URLSearchParams(init : String) : URLSearchParams

Constructs a new URLSearchParams from the specified string.

Example:

Run

Results:

 

new URLSearchParams(init : URLSearchParams) : URLSearchParams

Constructs a new URLSearchParams that is a copy of init.

Example:

Run

Results:

 

Instance Methods

append(name : String, value : String) : undefined

Appends the specified name/value pair to this. Note, unlike set(), this allows multiple values for a given name.

Example:

Run

Results:

 

delete(name : String) : undefined

Removes all name/value pairs with the given name.

Example:

Run

Results:

 

get(name : String) : String

Gets the first value for the specified name.

Example:

Run

Results:

 

getAll(name : String) : Array<String>

Gets all values for the specified name.

Example:

Run

Results:

 

has(name : String) : Boolean

Returns true if name is defined in this.

Example:

Run

Results:

 

set(name : String, value : String) : undefined

Sets the value for the specified name. Note, if there are multiple values for name, all will be replaced with the new value. See also append().

Example:

Run

Results:

 

sort() : undefined

Sorts the name/value pairs by the name. Order of values for the same name is preserved.

Example:

Run

Results: