recursal/MDN huggingface dataset:
MediaTrackSettings: facingMode property
=======================================

 The `MediaTrackSettings` dictionary's
 **`facingMode`** property is a string
 indicating the direction in which the camera producing the video track represented by
 the `MediaStreamTrack` is currently facing. This lets you determine what
 value was selected to comply with your specified constraints for this property's value
 as described in the `MediaTrackConstraints.facingMode` property you
 provided when calling either `getUserMedia()`
 or `MediaStreamTrack.applyConstraints()`.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.facingMode` as returned by a
 call to `MediaDevices.getSupportedConstraints()`. However, typically this
 is unnecessary since browsers will ignore any constraints they're unfamiliar with.

 Because RTP doesn't include this information, tracks associated with a
 WebRTC `RTCPeerConnection`
 will never include this property.

Value
-----

 A string whose value is one of the strings in
 `VideoFacingModeEnum`.

### VideoFacingModeEnum

 The following strings are permitted values for the facing mode. These may represent
 separate cameras, or they may represent directions in which an adjustable camera can be
 pointed.

`"user"`

 The video source is facing toward the user; this includes, for example, the
 front-facing camera on a smartphone.


`"environment"`

 The video source is facing away from the user, thereby viewing their environment.
 This is the back camera on a smartphone.


`"left"`

 The video source is facing toward the user but to their left, such as a camera aimed
 toward the user but over their left shoulder.


`"right"`

 The video source is facing toward the user but to their right, such as a camera
 aimed toward the user but over their right shoulder.


Examples
--------

See the Constraint exerciser example.

Specifications
--------------

| Specification |
| --- |
| Media Capture and Streams # dom-mediatracksettings-facingmode |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints.facingMode`
* `MediaTrackSettings`
MediaTrackSettings: sampleSize property
=======================================

 The `MediaTrackSettings` dictionary's
 **`sampleSize`** property is an integer indicating the linear
 sample size (in bits per sample) the `MediaStreamTrack` is currently
 configured for. This lets you determine what value was selected to comply with your
 specified constraints for this property's value as described in the
 `MediaTrackConstraints.sampleSize` property you provided when calling
 either `getUserMedia()` or
 `MediaStreamTrack.applyConstraints()`.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.sampleSize` as returned by a
 call to `MediaDevices.getSupportedConstraints()`. However, typically this
 is unnecessary since browsers will ignore any constraints they're unfamiliar with.

Value
-----

 An integer value indicating how many bits each audio sample is represented by. The most
 commonly used sample size for many years now is 16 bits per sample, which was used for
 CD audio among others. Other common sample sizes are 8 (for reduced bandwidth
 requirements) and 24 (for high-resolution professional audio).

 Each audio channel on the track requires sampleSize bits.
 That means that a given sample actually uses (`sampleSize`/8)\*`channelCount` bytes of data.
 For example, 16-bit stereo audio requires (16/8)\*2 or 4 bytes per sample.

Examples
--------

See the Constraint exerciser example.

Specifications
--------------

| Specification |
| --- |
| Media Capture and Streams # dom-mediatracksettings-samplesize |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints.sampleSize`
* `MediaTrackSettings`
URLSearchParams: delete() method
================================

The **`delete()`** method of the `URLSearchParams` interface deletes specified parameters and their associated value(s) from the list of all search parameters.

 A parameter name and optional value are used to match parameters.
 If only a parameter name is specified, then all search parameters that match the name are deleted, along with their associated values.
 If both a parameter name and value are specified, then all search parameters that match both the parameter name and value are deleted.

**Note:** This feature is available in Web Workers

Syntax
------


```js
delete(name)
delete(name, value)
```

### Parameters

`name`

The name of the parameters to be deleted.

`value` Optional

The value that parameters must match, along with the given name, to be deleted.

### Return value

None (`undefined`).

Examples
--------

### Delete all parameters with specified name

This example shows how to delete all query parameters (and values) that have a particular name.
```

<pre id="log"></pre>
```


```
const logElement = document.getElementById("log");
function log(text) {
  logElement.innerText += `${text}\n`;
}
```



```js
const url = new URL("https://example.com?foo=1&bar=2&foo=3");
const params = new URLSearchParams(url.search);
log(`Query string (before):\t ${params}`);
params.delete("foo");
log(`Query string (after):\t ${params}`);
```


The log below shows that all parameters that have the name of `foo` are deleted.

### Delete parameters with specified name and value

This example shows how to delete query parameters that match a particular name and value.
```

<pre id="log"></pre>
```


```
const logElement = document.getElementById("log");
function log(text) {
  logElement.innerText += `${text}\n`;
}
```



```js
const url = new URL("https://example.com?foo=1&bar=2&foo=3&foo=1");
const params = new URLSearchParams(url.search);
log(`Query string (before):\t ${params}`);
params.delete("foo", "1");
log(`Query string (after):\t ${params}`);
```


All parameters that match both the parameter `name` and `value` should be deleted (there is no reason to specify two parameters with the same name and value as shown above).

 If your browser supports the `value` option, the "after" string should be `bar=2&foo=3`.
 Otherwise the result will be the same as in the previous example (`bar=2`).

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-delete |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `URLSearchParams` in `core-js`
URLSearchParams: forEach() method
=================================

 The **`forEach()`** method of the
 `URLSearchParams` interface allows iteration through all values contained
 in this object via a callback function.

**Note:** This feature is available in Web Workers

Syntax
------


```js
forEach(callback)
forEach(callback, thisArg)
```

### Parameters

`callback`

Function to execute on each element, which is passed the following arguments:

`value`

The value of the current entry being processed in the `URLSearchParams` object.

`key`

The key of the current entry being processed in the `URLSearchParams` object.

`searchParams`

The `URLSearchParams` object the `forEach()` was called upon.


`thisArg` Optional

Value to use as `this` when executing `callback`.

### Return value

None (`undefined`).

Examples
--------


```js
// Create a test URLSearchParams object
const searchParams = new URLSearchParams("key1=value1&key2=value2");

// Log the values
searchParams.forEach((value, key) => {
  console.log(value, key);
});
```


The result is:
```

value1 key1
value2 key2
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-urlsearchparams |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* The `URL` interface.
URLSearchParams: toString() method
==================================

 The **`toString()`** method of the
 `URLSearchParams` interface returns a query string suitable for use in a
 URL.

**Note:** This method returns the query string without the question mark. This is different from `Location.search`, `HTMLAnchorElement.search`, and `URL.search`, which all include the question mark.

**Note:** This feature is available in Web Workers

Syntax
------


```js
toString()
```

### Parameters

None.

### Return value

 A string, without the question mark. (Returns an empty string if no
 search parameters have been set.)

Examples
--------


```js
const url = new URL("https://example.com?foo=1&bar=2");
const params = new URLSearchParams(url.search);

// Add a second foo parameter.
params.append("foo", 4);
console.log(params.toString()); // Prints 'foo=1&bar=2&foo=4'
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # urlsearchparams-stringification-behavior |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* The `URL` interface.
* Google Developers: Easy URL manipulation with URLSearchParams
URLSearchParams: get() method
=============================

 The **`get()`** method of the `URLSearchParams`
 interface returns the first value associated to the given search parameter.

**Note:** This feature is available in Web Workers

Syntax
------


```js
get(name)
```

### Parameters

`name`

The name of the parameter to return.

### Return value

 A string if the given search parameter is found; otherwise,
 **`null`**.

Examples
--------

 If the URL of your page is `https://example.com/?name=Jonathan&age=18`
 you could parse out the 'name' and 'age' parameters using:


```js
let params = new URLSearchParams(document.location.search);
let name = params.get("name"); // is the string "Jonathan"
let age = parseInt(params.get("age"), 10); // is the number 18
```


 Requesting a parameter that isn't present in the query string will return
 **`null`**:


```js
let address = params.get("address"); // null
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-get |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
URLSearchParams: has() method
=============================

The **`has()`** method of the `URLSearchParams` interface returns a boolean value that indicates whether the specified parameter is in the search parameters.

 A parameter name and optional value are used to match parameters.
 If only a parameter name is specified, then the method will return `true` if any parameters in the query string match the name, and `false` otherwise.
 If both a parameter name and value are specified, then the method will return `true` if a parameter matches both the name and value.

**Note:** This feature is available in Web Workers

Syntax
------


```js
has(name)
has(name, value)
```

### Parameters

`name`

The name of the parameter to match.

`value`

The value of the parameter, along with the given name, to match.

### Return value

A boolean value.

Examples
--------

### Check for parameter with specified name

This example shows how to check if the query string has any parameters with a particular name.
```

<pre id="log"></pre>
```


```
const logElement = document.getElementById("log");
function log(text) {
  logElement.innerText += `${text}\n`;
}
```



```js
const url = new URL("https://example.com?foo=1&bar=2&foo=3");
const params = new URLSearchParams(url.search);

// has() returns true if the parameter is in the query string
log(`bar?:\t${params.has("bar")}`);
log(`bark?:\t${params.has("bark")}`);
log(`foo?:\t${params.has("foo")}`);
```


The log below shows whether the parameters `bar`, `bark`, and `foo`, are present in the query string.

### Check for parameter with specified name and value

This example shows how to check whether the query string has a parameter that matches both a particular name and value.
```

<pre id="log"></pre>
```


```
const logElement = document.getElementById("log");
function log(text) {
  logElement.innerText += `${text}\n`;
}
```



```js
const url = new URL("https://example.com?foo=1&bar=2&foo=3");
const params = new URLSearchParams(url.search);

// has() returns true if a parameter with the matching name and value is in the query string
log(`bar=1?:\t${params.has("bar", "1")}`);
log(`bar=2?:\t${params.has("bar", "2")}`);
log(`foo=4?:\t${params.has("foo", "4")}`);
```


Only the second value above should be `true`, as only the parameter name `bar` with value `2` is matched.

If your browser does not support the `value` option the method will match on the name, and all the results should be `true`.

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-has |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `URLSearchParams` in `core-js`
URLSearchParams: URLSearchParams() constructor
==============================================

 The **`URLSearchParams()`** constructor creates and returns a
 new `URLSearchParams` object.

**Note:** This feature is available in Web Workers

Syntax
------


```js
new URLSearchParams()
new URLSearchParams(options)
```

### Parameters

`options` Optional

One of:

* A string, which will be parsed from `application/x-www-form-urlencoded` format. A leading `'?'` character is ignored.
* A literal sequence of name-value string pairs, or any object — such as a `FormData` object — with an iterator that produces a sequence of string pairs. Note that `File` entries will be serialized as `[object File]` rather than as their filename (as they would in an `application/x-www-form-urlencoded` form).
* A record of string keys and string values. Note that nesting is not supported.

### Return value

A `URLSearchParams` object instance.

Examples
--------

 The following example shows how to create a `URLSearchParams` object from
 various inputs.


```js
// Retrieve params via url.search, passed into constructor
const url = new URL("https://example.com?foo=1&bar=2");
const params1 = new URLSearchParams(url.search);

// Get the URLSearchParams object directly from a URL object
const params1a = url.searchParams;

// Pass in a string literal
const params2 = new URLSearchParams("foo=1&bar=2");
const params2a = new URLSearchParams("?foo=1&bar=2");

// Pass in a sequence of pairs
const params3 = new URLSearchParams([
  ["foo", "1"],
  ["bar", "2"],
]);

// Pass in a record
const params4 = new URLSearchParams({ foo: "1", bar: "2" });
```


This example shows how to build a new URL with an object of search parameters from an existing URL that has search parameters.


```js
const url = new URL("https://example.com/?a=hello&b=world");

console.log(url.href);
// https://example.com/?a=hello&b=world

console.log(url.origin);
// https://example.com

const add_params = {
  c: "a",
  d: new String(2),
  e: false.toString(),
};

const new_params = new URLSearchParams([
  ...Array.from(url.searchParams.entries()), // [["a","hello"],["b","world"]]
  ...Object.entries(add_params), // [["c","a"],["d","2"],["e","false"]]
]).toString();
console.log(new_params);
// a=hello&b=world&c=a&d=2&e=false

const new_url = new URL(`${url.origin}${url.pathname}?${new\_params}`);

console.log(new_url.href);
// https://example.com/?a=hello&b=world&c=a&d=2&e=false

// Here it is as a function that accepts (URL, Record<string, string>)
const addSearchParams = (url, params = {}) =>
  new URL(
    `${url.origin}${url.pathname}?${new URLSearchParams([
 ...Array.from(url.searchParams.entries()),
 ...Object.entries(params),
 ])}`,
  );
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-urlsearchparams |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
URLSearchParams: sort() method
==============================

 The **`URLSearchParams.sort()`** method sorts all key/value
 pairs contained in this object in place and returns `undefined`. The sort
 order is according to unicode code points of the keys. This method uses a stable sorting
 algorithm (i.e. the relative order between key/value pairs with equal keys will be
 preserved).

**Note:** This feature is available in Web Workers

Syntax
------


```js
sort()
```

### Parameters

None.

### Return value

None (`undefined`).

Examples
--------


```js
// Create a test URLSearchParams object
const searchParams = new URLSearchParams("c=4&a=2&b=3&a=1");

// Sort the key/value pairs
searchParams.sort();

// Display the sorted query string
console.log(searchParams.toString());
```


The result is:
```

a=2&a=1&b=3&c=4
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-sort |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
URLSearchParams: keys() method
==============================

 The **`keys()`** method of the `URLSearchParams`
 interface returns an `iterator` allowing iteration
 through all keys contained in this object. The keys are string
 objects.

**Note:** This feature is available in Web Workers

Syntax
------


```js
keys()
```

### Parameters

None.

### Return value

Returns an `iterator`.

Examples
--------


```js
// Create a test URLSearchParams object
const searchParams = new URLSearchParams("key1=value1&key2=value2");

// Display the keys
for (const key of searchParams.keys()) {
  console.log(key);
}
```


The result is:
```

key1
key2
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-urlsearchparams |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* The `URL` interface.
URLSearchParams: set() method
=============================

 The **`set()`** method of the `URLSearchParams`
 interface sets the value associated with a given search parameter to the given value.
 If there were several matching values, this method deletes the others. If the search
 parameter doesn't exist, this method creates it.

**Note:** This feature is available in Web Workers

Syntax
------


```js
set(name, value)
```

### Parameters

`name`

The name of the parameter to set.

`value`

The value of the parameter to set.

### Return value

None (`undefined`).

Examples
--------


```js
let url = new URL("https://example.com?foo=1&bar=2");
let params = new URLSearchParams(url.search);

// Add a third parameter.
params.set("baz", 3);
params.toString(); // "foo=1&bar=2&baz=3"
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-set |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
URLSearchParams: size property
==============================

The **`size`** read-only property of the `URLSearchParams` interface indicates the total number of search parameter entries.

**Note:** This feature is available in Web Workers

Value
-----

A number indicating the total number of search parameter entries in the `URLSearchParams` object.

Examples
--------

### Getting the amount of search parameter entries

You can get the total number of search parameter entries like so:


```js
const searchParams = new URLSearchParams("c=4&a=2&b=3&a=1");
searchParams.size; // 4
```


Note how the `a` parameter is given twice, but `size` returns the number of all given entries (4) and not 3. To get the amount of unique keys, you can use a `Set`, for example:


```js
[...new Set(searchParams.keys())].length; // 3
```

### Checking if search parameters exist

The `size` property is useful for checking whether there are any search parameters at all:


```js
const url = new URL("https://example.com?foo=1&bar=2");

if (url.searchParams.size) {
  console.log("URL has search parameters!");
}
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-size |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `URL.searchParams`
* Polyfill of `URLSearchParams` in `core-js`
URLSearchParams: values() method
================================

 The **`values()`** method of the `URLsearchParams`
 interface returns an `iterator` allowing iteration
 through all values contained in this object. The values are string
 objects.

**Note:** This feature is available in Web Workers

Syntax
------


```js
values()
```

### Parameters

None.

### Return value

Returns an `iterator`.

Examples
--------

The following example passes a URL search string to the `URLSearchParams` constructor, then uses the iterator returned by `values()` to print the values to the console.


```js
const searchParams = new URLSearchParams("key1=value1&key2=value2");

for (const value of searchParams.values()) {
  console.log(value);
}
```


The result is:
```

value1
value2
```


This example does much the same as above, but first casts the iterator into an array.


```js
const searchParams = new URLSearchParams("key1=value1&key2=value2");

console.log(Array.from(searchParams.values()));
```


The result is:
```

['value1', 'value2']
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-urlsearchparams |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* The `URL` interface.
URLSearchParams: getAll() method
================================

 The **`getAll()`** method of the `URLSearchParams`
 interface returns all the values associated with a given search parameter as an array.

**Note:** This feature is available in Web Workers

Syntax
------


```js
getAll(name)
```

### Parameters

`name`

The name of the parameter to return.

### Return value

An array of strings, which may be empty if no values for the given parameter are found.

Examples
--------


```js
let url = new URL("https://example.com?foo=1&bar=2");
let params = new URLSearchParams(url.search);

//Add a second foo parameter.
params.append("foo", 4);

console.log(params.getAll("foo")); //Prints ["1","4"].
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-getall |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
URLSearchParams: append() method
================================

 The **`append()`** method of the `URLSearchParams`
 interface appends a specified key/value pair as a new search parameter.

 As shown in the example below, if the same key is appended multiple times it will
 appear in the parameter string multiple times for each value.

**Note:** This feature is available in Web Workers

Syntax
------


```js
append(name, value)
```

### Parameters

`name`

The name of the parameter to append.

`value`

The value of the parameter to append.

### Return value

None (`undefined`).

Examples
--------


```js
let url = new URL("https://example.com?foo=1&bar=2");
let params = new URLSearchParams(url.search);

//Add a second foo parameter.
params.append("foo", 4);
//Query string is now: 'foo=1&bar=2&foo=4'
```

Specifications
--------------

| Specification |
| --- |
| URL Standard # dom-urlsearchparams-append |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `URL`
* Google Developers: Easy URL manipulation with URLSearchParams