recursal/MDN huggingface dataset:
AsyncIterator
=============

An **`AsyncIterator`** object is an object that conforms to the async iterator protocol by providing a `next()` method that returns a promise fulfilling to an iterator result object. The `AsyncIterator.prototype` object is a hidden global object that all built-in async iterators inherit from. It provides an `@@asyncIterator` method that returns the async iterator object itself, making the async iterator also async iterable.

Note that `AsyncIterator` is *not* a global object, although it will be in the future with the async iterator helpers proposal. The `AsyncIterator.prototype` object shared by all built-in async iterators can be obtained with the following code:


```js
const AsyncIteratorPrototype = Object.getPrototypeOf(
  Object.getPrototypeOf(Object.getPrototypeOf((async function\* () {})())),
);
```

Description
-----------

Currently, the only built-in JavaScript async iterator is the `AsyncGenerator` object returned by async generator functions. There are some other built-in async iterators in web API, such as the one of a `ReadableStream`.

Each of these async iterators have a distinct prototype object, which defines the `next()` method used by the particular async iterator. All of these prototype objects inherit from `AsyncIterator.prototype`, which provides am `@@asyncIterator` method that returns the async iterator object itself, making the async iterator also async iterable.

**Note:** `AsyncIterator.prototype` does not implement `@@iterator`, so async iterators are not sync iterable by default.

Instance methods
----------------

`AsyncIterator.prototype[@@asyncIterator]()`

Returns the async iterator object itself. This allows async iterator objects to also be async iterable.

Examples
--------

### Using an async iterator as an async iterable

All built-in async iterators are also async iterable, so you can use them in a `for await...of` loop:


```js
const asyncIterator = (async function\* () {
  yield 1;
  yield 2;
  yield 3;
})();
(async () => {
  for await (const value of asyncIterator) {
    console.log(value);
  }
})();
// Logs: 1, 2, 3
```

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

| Specification |
| --- |
| ECMAScript Language Specification # sec-asynciteratorprototype |

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

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

See also
--------

* `async function*`
* Iteration protocols
EvalError
=========

The **`EvalError`** object indicates an error regarding the global `eval()` function. This exception is not thrown by JavaScript anymore, however the `EvalError` object remains for compatibility.

`EvalError` is a serializable object, so it can be cloned with `structuredClone()` or copied between Workers using `postMessage()`.

`EvalError` is a subclass of `Error`.

Constructor
-----------

`EvalError()`

Creates a new `EvalError` object.

Instance properties
-------------------

*Also inherits instance properties from its parent `Error`*.

These properties are defined on `EvalError.prototype` and shared by all `EvalError` instances.

`EvalError.prototype.constructor`

The constructor function that created the instance object. For `EvalError` instances, the initial value is the `EvalError` constructor.

`EvalError.prototype.name`

Represents the name for the type of error. For `EvalError.prototype.name`, the initial value is `"EvalError"`.

Instance methods
----------------

*Inherits instance methods from its parent `Error`*.

Examples
--------

### Creating an EvalError


```js
try {
  throw new EvalError("Hello");
} catch (e) {
  console.log(e instanceof EvalError); // true
  console.log(e.message); // "Hello"
  console.log(e.name); // "EvalError"
  console.log(e.stack); // Stack of the error
}
```

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

| Specification |
| --- |
| ECMAScript Language Specification # sec-native-error-types-used-in-this-standard-evalerror |

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

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

See also
--------

* `Error`
* `eval()`
Uint16Array
===========

The **`Uint16Array`** typed array represents an array of 16-bit unsigned integers in the platform byte order. If control over byte order is needed, use `DataView` instead. The contents are initialized to `0`. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).

`Uint16Array` is a subclass of the hidden `TypedArray` class.

Constructor
-----------

`Uint16Array()`

Creates a new `Uint16Array` object.

Static properties
-----------------

*Also inherits static properties from its parent `TypedArray`*.

`Uint16Array.BYTES_PER_ELEMENT`

Returns a number value of the element size. `2` in the case of `Uint16Array`.

Static methods
--------------

*Inherits static methods from its parent `TypedArray`*.

Instance properties
-------------------

*Also inherits instance properties from its parent `TypedArray`*.

These properties are defined on `Uint16Array.prototype` and shared by all `Uint16Array` instances.

`Uint16Array.prototype.BYTES_PER_ELEMENT`

Returns a number value of the element size. `2` in the case of a `Uint16Array`.

`Uint16Array.prototype.constructor`

The constructor function that created the instance object. For `Uint16Array` instances, the initial value is the `Uint16Array` constructor.

Instance methods
----------------

*Inherits instance methods from its parent `TypedArray`*.

Examples
--------

### Different ways to create a Uint16Array


```js
// From a length
const uint16 = new Uint16Array(2);
uint16[0] = 42;
console.log(uint16[0]); // 42
console.log(uint16.length); // 2
console.log(uint16.BYTES\_PER\_ELEMENT); // 2

// From an array
const x = new Uint16Array([21, 31]);
console.log(x[1]); // 31

// From another TypedArray
const y = new Uint16Array(x);
console.log(y[0]); // 21

// From an ArrayBuffer
const buffer = new ArrayBuffer(16);
const z = new Uint16Array(buffer, 2, 4);
console.log(z.byteOffset); // 2

// From an iterable
const iterable = (function\* () {
  yield\* [1, 2, 3];
})();
const uint16FromIterable = new Uint16Array(iterable);
console.log(uint16FromIterable);
// Uint16Array [1, 2, 3]
```

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

| Specification |
| --- |
| ECMAScript Language Specification # table-49 |

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

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

See also
--------

* Polyfill of `Uint16Array` in `core-js`
* JavaScript typed arrays guide
* `TypedArray`
* `ArrayBuffer`
* `DataView`
decodeURIComponent()
====================

The **`decodeURIComponent()`** function decodes a Uniform Resource Identifier (URI) component previously created by `encodeURIComponent()` or by a similar routine.

Try it
------

Syntax
------


```js
decodeURIComponent(encodedURI)
```

### Parameters

`encodedURI`

An encoded component of a Uniform Resource Identifier.

### Return value

A new string representing the decoded version of the given encoded Uniform Resource Identifier (URI) component.

### Exceptions

`URIError`

Thrown if `encodedURI` contains a `%` not followed by two hexadecimal digits, or if the escape sequence does not encode a valid UTF-8 character.

Description
-----------

`decodeURIComponent()` is a function property of the global object.

`decodeURIComponent()` uses the same decoding algorithm as described in `decodeURI()`. It decodes *all* escape sequences, including those that are not created by `encodeURIComponent`, like `-.!~*'()`.

Examples
--------

### Decoding a Cyrillic URL component


```js
decodeURIComponent("JavaScript\_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B");
// "JavaScript\_шеллы"
```

### Catching errors


```js
try {
  const a = decodeURIComponent("%E0%A4%A");
} catch (e) {
  console.error(e);
}

// URIError: malformed URI sequence
```

### Decoding query parameters from a URL

`decodeURIComponent()` cannot be used directly to parse query parameters from a URL. It needs a bit of preparation.


```js
function decodeQueryParam(p) {
  return decodeURIComponent(p.replace(/\+/g, " "));
}

decodeQueryParam("search+query%20%28correct%29");
// 'search query (correct)'
```

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

| Specification |
| --- |
| ECMAScript Language Specification # sec-decodeuricomponent-encodeduricomponent |

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

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

See also
--------

* `decodeURI`
* `encodeURI`
* `encodeURIComponent`
AsyncFunction
=============

Baseline Widely available
-------------------------

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017.

* Learn more
* See full compatibility
* Report feedback
The **`AsyncFunction`** object provides methods for async functions. In JavaScript, every async function is actually an `AsyncFunction` object.

Note that `AsyncFunction` is *not* a global object. It can be obtained with the following code:


```js
const AsyncFunction = async function () {}.constructor;
```


`AsyncFunction` is a subclass of `Function`.

Constructor
-----------

`AsyncFunction()`

Creates a new `AsyncFunction` object.

Instance properties
-------------------

*Also inherits instance properties from its parent `Function`*.

These properties are defined on `AsyncFunction.prototype` and shared by all `AsyncFunction` instances.

`AsyncFunction.prototype.constructor`

The constructor function that created the instance object. For `AsyncFunction` instances, the initial value is the `AsyncFunction` constructor.

`AsyncFunction.prototype[@@toStringTag]`

The initial value of the `@@toStringTag` property is the string `"AsyncFunction"`. This property is used in `Object.prototype.toString()`.


**Note:** `AsyncFunction` instances do not have the `prototype` property.

Instance methods
----------------

*Inherits instance methods from its parent `Function`*.

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

| Specification |
| --- |
| ECMAScript Language Specification # sec-async-function-objects |

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

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

See also
--------

* `async function`
* `async function` expression
* `Function`
* `AsyncGeneratorFunction`
* `GeneratorFunction`
* Functions
decodeURI()
===========

The **`decodeURI()`** function decodes a Uniform Resource Identifier (URI) previously created by `encodeURI()` or a similar routine.

Try it
------

Syntax
------


```js
decodeURI(encodedURI)
```

### Parameters

`encodedURI`

A complete, encoded Uniform Resource Identifier.

### Return value

A new string representing the unencoded version of the given encoded Uniform Resource Identifier (URI).

### Exceptions

`URIError`

Thrown if `encodedURI` contains a `%` not followed by two hexadecimal digits, or if the escape sequence does not encode a valid UTF-8 character.

Description
-----------

`decodeURI()` is a function property of the global object.

The `decodeURI()` function decodes the URI by treating each escape sequence in the form `%XX` as one UTF-8 code unit (one byte). In UTF-8, the number of leading 1 bits in the first byte, which may be 0 (for 1-byte ASCII characters), 2, 3, or 4, indicates the number of bytes in the character. So by reading the first escape sequence, `decodeURI()` can determine how many more escape sequences to consume. If `decodeURI()` fails to find the expected number of sequences, or if the escape sequences don't encode a valid UTF-8 character, a `URIError` is thrown.

`decodeURI()` decodes all escape sequences, but if the escape sequence encodes one of the following characters, the escape sequence is preserved in the output string (because they are part of the URI syntax):
```

; / ? : @ & = + $ , #
```

Examples
--------

### Decoding a Cyrillic URL


```js
decodeURI(
  "https://developer.mozilla.org/ru/docs/JavaScript\_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B",
);
// "https://developer.mozilla.org/ru/docs/JavaScript\_шеллы"
```

### decodeURI() vs. decodeURIComponent()

`decodeURI()` assumes the input is a full URI, so it does not decode characters that are part of the URI syntax.


```js
decodeURI(
  "https://developer.mozilla.org/docs/JavaScript%3A%20a\_scripting\_language",
);
// "https://developer.mozilla.org/docs/JavaScript%3A a\_scripting\_language"

decodeURIComponent(
  "https://developer.mozilla.org/docs/JavaScript%3A%20a\_scripting\_language",
);
// "https://developer.mozilla.org/docs/JavaScript: a\_scripting\_language"
```

### Catching errors


```js
try {
  const a = decodeURI("%E0%A4%A");
} catch (e) {
  console.error(e);
}

// URIError: malformed URI sequence
```

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

| Specification |
| --- |
| ECMAScript Language Specification # sec-decodeuri-encodeduri |

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

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

See also
--------

* `decodeURIComponent()`
* `encodeURI()`
* `encodeURIComponent()`
Float32Array
============

The **`Float32Array`** typed array represents an array of 32-bit floating point numbers in the platform byte order. If control over byte order is needed, use `DataView` instead. The contents are initialized to `0`. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).

`Float32Array` is a subclass of the hidden `TypedArray` class.

Constructor
-----------

`Float32Array()`

Creates a new `Float32Array` object.

Static properties
-----------------

*Also inherits static properties from its parent `TypedArray`*.

`Float32Array.BYTES_PER_ELEMENT`

Returns a number value of the element size. `4` in the case of `Float32Array`.

Static methods
--------------

*Inherits static methods from its parent `TypedArray`*.

Instance properties
-------------------

*Also inherits instance properties from its parent `TypedArray`*.

These properties are defined on `Float32Array.prototype` and shared by all `Float32Array` instances.

`Float32Array.prototype.BYTES_PER_ELEMENT`

Returns a number value of the element size. `4` in the case of a `Float32Array`.

`Float32Array.prototype.constructor`

The constructor function that created the instance object. For `Float32Array` instances, the initial value is the `Float32Array` constructor.

Instance methods
----------------

*Inherits instance methods from its parent `TypedArray`*.

Examples
--------

### Different ways to create a Float32Array


```js
// From a length
const float32 = new Float32Array(2);
float32[0] = 42;
console.log(float32[0]); // 42
console.log(float32.length); // 2
console.log(float32.BYTES\_PER\_ELEMENT); // 4

// From an array
const x = new Float32Array([21, 31]);
console.log(x[1]); // 31

// From another TypedArray
const y = new Float32Array(x);
console.log(y[0]); // 21

// From an ArrayBuffer
const buffer = new ArrayBuffer(32);
const z = new Float32Array(buffer, 4, 4);
console.log(z.byteOffset); // 4

// From an iterable
const iterable = (function\* () {
  yield\* [1, 2, 3];
})();
const float32FromIterable = new Float32Array(iterable);
console.log(float32FromIterable);
// Float32Array [1, 2, 3]
```

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

| Specification |
| --- |
| ECMAScript Language Specification # table-49 |

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

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

See also
--------

* Polyfill of `Float32Array` in `core-js`
* JavaScript typed arrays guide
* `TypedArray`
* `ArrayBuffer`
* `DataView`
InternalError
=============

**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The **`InternalError`** object indicates an error that occurred internally in the JavaScript engine.

Example cases are mostly when something is too large, e.g.:

* "too many switch cases",
* "too many parentheses in regular expression",
* "array initializer too large",
* "too much recursion".

`InternalError` is a subclass of `Error`.

Constructor
-----------

`InternalError()` 
Non-standard

Creates a new `InternalError` object.

Instance properties
-------------------

*Also inherits instance properties from its parent `Error`*.

These properties are defined on `InternalError.prototype` and shared by all `InternalError` instances.

`InternalError.prototype.constructor`

The constructor function that created the instance object. For `InternalError` instances, the initial value is the `InternalError` constructor.

`InternalError.prototype.name`

Represents the name for the type of error. For `InternalError.prototype.name`, the initial value is `"InternalError"`.

Instance methods
----------------

*Inherits instance methods from its parent `Error`*.

Examples
--------

### Too much recursion

This recursive function runs 10 times, as per the exit condition.


```js
function loop(x) {
  // "x >= 10" is the exit condition
  if (x >= 10) return;

  // do stuff
  loop(x + 1); // the recursive call
}
loop(0);
```


Setting this condition to an extremely high value, may not work:


```js
function loop(x) {
  if (x >= 1000000000000) return;

  // do stuff
  loop(x + 1);
}
loop(0);

// InternalError: too much recursion
```


For more information, see InternalError: too much recursion.

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

Not part of any standard.

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

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

See also
--------

* `Error`
* InternalError: too much recursion
ReferenceError
==============

The **`ReferenceError`** object represents an error when a variable that doesn't exist (or hasn't yet been initialized) in the current scope is referenced.

`ReferenceError` is a serializable object, so it can be cloned with `structuredClone()` or copied between Workers using `postMessage()`.

`ReferenceError` is a subclass of `Error`.

Constructor
-----------

`ReferenceError()`

Creates a new `ReferenceError` object.

Instance properties
-------------------

*Also inherits instance properties from its parent `Error`*.

These properties are defined on `ReferenceError.prototype` and shared by all `ReferenceError` instances.

`ReferenceError.prototype.constructor`

The constructor function that created the instance object. For `ReferenceError` instances, the initial value is the `ReferenceError` constructor.

`ReferenceError.prototype.name`

Represents the name for the type of error. For `ReferenceError.prototype.name`, the initial value is `"ReferenceError"`.

Instance methods
----------------

*Inherits instance methods from its parent `Error`*.

Examples
--------

### Catching a ReferenceError


```js
try {
  let a = undefinedVariable;
} catch (e) {
  console.log(e instanceof ReferenceError); // true
  console.log(e.message); // "undefinedVariable is not defined"
  console.log(e.name); // "ReferenceError"
  console.log(e.stack); // Stack of the error
}
```

### Creating a ReferenceError


```js
try {
  throw new ReferenceError("Hello");
} catch (e) {
  console.log(e instanceof ReferenceError); // true
  console.log(e.message); // "Hello"
  console.log(e.name); // "ReferenceError"
  console.log(e.stack); // Stack of the error
}
```

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

| Specification |
| --- |
| ECMAScript Language Specification # sec-native-error-types-used-in-this-standard-referenceerror |

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

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

See also
--------

* `Error`
Uint32Array
===========

The **`Uint32Array`** typed array represents an array of 32-bit unsigned integers in the platform byte order. If control over byte order is needed, use `DataView` instead. The contents are initialized to `0`. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).

`Uint32Array` is a subclass of the hidden `TypedArray` class.

Constructor
-----------

`Uint32Array()`

Creates a new `Uint32Array` object.

Static properties
-----------------

*Also inherits static properties from its parent `TypedArray`*.

`Uint32Array.BYTES_PER_ELEMENT`

Returns a number value of the element size. `4` in the case of `Uint32Array`.

Static methods
--------------

*Inherits static methods from its parent `TypedArray`*.

Instance properties
-------------------

*Also inherits instance properties from its parent `TypedArray`*.

These properties are defined on `Uint32Array.prototype` and shared by all `Uint32Array` instances.

`Uint32Array.prototype.BYTES_PER_ELEMENT`

Returns a number value of the element size. `4` in the case of a `Uint32Array`.

`Uint32Array.prototype.constructor`

The constructor function that created the instance object. For `Uint32Array` instances, the initial value is the `Uint32Array` constructor.

Instance methods
----------------

*Inherits instance methods from its parent `TypedArray`*.

Examples
--------

### Different ways to create a Uint32Array


```js
// From a length
const uint32 = new Uint32Array(2);
uint32[0] = 42;
console.log(uint32[0]); // 42
console.log(uint32.length); // 2
console.log(uint32.BYTES\_PER\_ELEMENT); // 4

// From an array
const x = new Uint32Array([21, 31]);
console.log(x[1]); // 31

// From another TypedArray
const y = new Uint32Array(x);
console.log(y[0]); // 21

// From an ArrayBuffer
const buffer = new ArrayBuffer(32);
const z = new Uint32Array(buffer, 4, 4);
console.log(z.byteOffset); // 4

// From an iterable
const iterable = (function\* () {
  yield\* [1, 2, 3];
})();
const uint32FromIterable = new Uint32Array(iterable);
console.log(uint32FromIterable);
// Uint32Array [1, 2, 3]
```

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

| Specification |
| --- |
| ECMAScript Language Specification # table-49 |

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

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

See also
--------

* Polyfill of `Uint32Array` in `core-js`
* JavaScript typed arrays guide
* `TypedArray`
* `ArrayBuffer`
* `DataView`