recursal/MDN huggingface dataset:
SyntaxError: missing ; before statement
=======================================

 The JavaScript exception "missing ; before statement" occurs when there is a semicolon (`;`)
 missing somewhere and can't be added
 by automatic semicolon insertion (ASI).
 You need to provide a semicolon, so that JavaScript can parse the source code correctly.

Message
-------
```

SyntaxError: Expected ';' (Edge)
SyntaxError: missing ; before statement (Firefox)
```

Error type
----------

`SyntaxError`.

What went wrong?
----------------

 There is a semicolon (`;`) missing somewhere. JavaScript statements must
 be terminated with semicolons. Some of them are affected
 by automatic semicolon insertion (ASI),
 but in this case you need to provide a semicolon,
 so that JavaScript can parse the source code correctly.

 However, oftentimes, this error is only a consequence of another error, like not
 escaping strings properly, or using `var` wrongly. You might also have too
 many parenthesis somewhere. Carefully check the syntax when this error is thrown.

Examples
--------

### Unescaped strings

 This error can occur easily when not escaping strings properly and the JavaScript
 engine is expecting the end of your string already. For example:


```js
const foo = 'Tom's bar';
// SyntaxError: missing ; before statement
```


You can use double quotes, or escape the apostrophe:


```js
const foo = "Tom's bar";
// OR
const foo = 'Tom\'s bar';
```

### Declaring properties with keyword

 You **cannot** declare properties of an object or array with a
 `let`, `const`, or `var` declaration.


```js
const obj = {};
const obj.foo = "hi"; // SyntaxError missing ; before statement

const array = [];
const array[0] = "there"; // SyntaxError missing ; before statement
```


Instead, omit the keyword:


```js
const obj = {};
obj.foo = "hi";

const array = [];
array[0] = "there";
```

### Bad keywords

 If you come from another programming language, it is also common to use keywords that
 don't mean the same or have no meaning at all in JavaScript:


```js
def print(info) {
  console.log(info);
} // SyntaxError missing ; before statement
```


Instead, use `function` instead of `def`:


```js
function print(info) {
  console.log(info);
}
```

See also
--------

* Automatic semicolon insertion (ASI)
* Statements and declarations
ReferenceError: can't access lexical declaration 'X' before initialization
==========================================================================

 The JavaScript exception "can't access lexical declaration `*variable*' before initialization" occurs when a lexical variable was accessed before it was initialized.
 This happens within any block statement, when `let` or `const` variables are accessed before the place where they are declared is executed.

Message
-------
```

ReferenceError: Cannot access 'X' before initialization (V8-based)
ReferenceError: can't access lexical declaration 'X' before initialization (Firefox)
ReferenceError: Cannot access uninitialized variable. (Safari)
```

Error type
----------

`ReferenceError`What went wrong?
----------------

 A lexical variable was accessed before it was initialized.
 This happens within any block statement, when variables declared with `let` or `const` are accessed before the place where they are declared has been executed.

 Note that it is the execution order of access and variable declaration that matters, not the order in which the statements appear in the code.
 For more information, see the description of Temporal Dead Zone.

This issue does not occur for variables declared using `var`, because they are initialized with a default value of `undefined` when they are hoisted.

This error can also occur in cyclic imports when a module uses a variable that depends on the module itself being evaluated.

Examples
--------

### Invalid cases

 In this case, the variable `foo` is accessed before it is declared.
 At this point foo has not been initialized with a value, so accessing the variable throws a reference error.


```js
function test() {
  // Accessing the 'const' variable foo before it's declared
  console.log(foo); // ReferenceError: foo is not initialized
  const foo = 33; // 'foo' is declared and initialized here using the 'const' keyword
}

test();
```


In this example, the imported variable `a` is accessed but is uninitialized, because the evaluation of `a.js` is blocked by the evaluation of the current module `b.js`.


```js
// -- a.js (entry module) --
import { b } from "./b.js";

export const a = 2;

// -- b.js --
import { a } from "./a.js";

console.log(a); // ReferenceError: Cannot access 'a' before initialization
export const b = 1;
```

### Valid cases

In the following example, we correctly declare a variable using the `const` keyword before accessing it.


```js
function test() {
  // Declaring variable foo
  const foo = 33;
  console.log(foo); // 33
}
test();
```


In this example, the imported variable `a` is asynchronously accessed, so both modules are evaluated before the access to `a` occurs.


```js
// -- a.js (entry module) --
import { b } from "./b.js";

export const a = 2;

// -- b.js --
import { a } from "./a.js";

setTimeout(() => {
  console.log(a); // 2
}, 10);
export const b = 1;
```

See also
--------

* `let`
* `const`
* `var`
* `class`
RangeError: BigInt negative exponent
====================================

The JavaScript exception "BigInt negative exponent" occurs when a `BigInt` is raised to the power of a negative BigInt value.

Message
-------
```

RangeError: Exponent must be positive (V8-based)
RangeError: BigInt negative exponent (Firefox)
RangeError: Negative exponent is not allowed (Safari)
```

Error type
----------

`RangeError`.

What went wrong?
----------------

The exponent of an exponentiation operation must be positive. Since negative exponents would take the reciprocal of the base, the result will be between -1 and 1 in almost all cases, which gets rounded to `0n`. To catch mistakes, negative exponents are not allowed. Check if the exponent is non-negative before doing exponentiation.

Examples
--------

### Using a negative BigInt as exponent


```js
const a = 1n;
const b = -1n;
const c = a \*\* b;
// RangeError: BigInt negative exponent
```


Instead, check if the exponent is negative first, and either issue an error with a better message, or fallback to a different value, like `0n` or `undefined`.


```js
const a = 1n;
const b = -1n;
const quotient = b >= 0n ? a \*\* b : 0n;
```

See also
--------

* `BigInt`
* Exponentiation (`**`)
SyntaxError: missing variable name
==================================

 The JavaScript exception "missing variable name" is a common error.
 It is usually caused by omitting a variable name or a typographic error.

Message
-------
```

SyntaxError: missing variable name (Firefox)
SyntaxError: Unexpected token '='. Expected a parameter pattern or a ')' in parameter list. (Safari)
```

Error type
----------

`SyntaxError`What went wrong?
----------------

 A variable is missing a name. The cause is most likely a typo or a forgotten variable name.
 Make sure that you've provided the name of the variable before the `=` sign.

When declaring multiple variables at the same time, make sure that the previous lines/declaration does not end with a comma instead of a semicolon.

Examples
--------

### Missing a variable name


```js
const = "foo";
```


It is easy to forget to assign a name for your variable!


```js
const description = "foo";
```

### Reserved keywords can't be variable names

 There are a few variable names that are reserved keywords.
 You can't use these. Sorry :(


```js
const debugger = "whoop";
// SyntaxError: missing variable name
```

### Declaring multiple variables

 Pay special attention to commas when declaring multiple variables.
 Is there an excess comma, or did you use commas instead of semicolons?
 Did you remember to assign values for all your `const` variables?


```js
let x, y = "foo",
const z, = "foo"

const first = document.getElementById("one"),
const second = document.getElementById("two"),

// SyntaxError: missing variable name
```


The fixed version:


```js
let x,
  y = "foo";
const z = "foo";

const first = document.getElementById("one");
const second = document.getElementById("two");
```

### Arrays

`Array` literals in JavaScript need square brackets around the values.
 This won't work:


```js
const arr = 1,2,3,4,5;
// SyntaxError: missing variable name
```


This would be correct:


```js
const arr = [1, 2, 3, 4, 5];
```

See also
--------

* Lexical grammar
* `var`
* Grammar and types guide
SyntaxError: missing name after . operator
==========================================

 The JavaScript exception "missing name after . operator" occurs when there is a problem
 with how the dot operator (`.`) is used
 for property access.

Message
-------
```

SyntaxError: missing name after . operator (Firefox)
SyntaxError: Unexpected token '['. Expected a property name after '.'. (Safari)
```

Error type
----------

`SyntaxError`What went wrong?
----------------

 The dot operator (`.`) is used for property access.
 You will have to specify the name of the property that you want to access.
 For computed property access, you might need to change your property access from using a
 dot to using square brackets. These will allow you to compute an expression. Maybe you
 intended to do concatenation instead? A plus operator (`+`) is needed in that
 case. Please see the examples below.

Examples
--------

### Property access

Property accessors
 in JavaScript use either the dot (.) or square brackets (`[]`), but not both.
 Square brackets allow computed property access.


```js
const obj = { foo: { bar: "baz", bar2: "baz2" } };
const i = 2;

obj.[foo].[bar]
// SyntaxError: missing name after . operator

obj.foo."bar"+i;
// SyntaxError: missing name after . operator
```


To fix this code, you need to access the object like this:


```js
obj.foo.bar; // "baz"
// or alternatively
obj["foo"]["bar"]; // "baz"

// computed properties require square brackets
obj.foo["bar" + i]; // "baz2"
// or as template literal
obj.foo[`bar${i}`]; // "baz2"
```

### Property access vs. concatenation

 If you are coming from another programming language (like PHP), it is also easy to mix up the dot operator
 (`.`) and the concatenation operator (`+`).


```js
console.log("Hello" . "world");

// SyntaxError: missing name after . operator
```


Instead you need to use a plus sign for concatenation:


```js
console.log("Hello" + "World");
```

See also
--------

* Property accessors
RangeError: invalid date
========================

 The JavaScript exception "invalid date" occurs when a string leading to an invalid date
 has been provided to `Date` or `Date.parse()`.

Message
-------
```

RangeError: Invalid time value (V8-based)
RangeError: invalid date (Firefox)
RangeError: Invalid Date (Safari)
```

Error type
----------

`RangeError`What went wrong?
----------------

 A string leading to an invalid date has been provided to `Date` or
 `Date.parse()`.

Examples
--------

### Invalid cases

 Unrecognizable strings or dates containing illegal element values in ISO formatted
 strings usually return `NaN`. However, depending on the implementation,
 non–conforming ISO format strings, may also throw `RangeError: invalid date`,
 like the following cases in Firefox:


```js
new Date("foo-bar 2014");
new Date("2014-25-23").toISOString();
new Date("foo-bar 2014").toString();
```


This, however, returns `NaN` in Firefox:


```js
Date.parse("foo-bar 2014"); // NaN
```


For more details, see the `Date.parse()` documentation.

### Valid cases


```js
new Date("05 October 2011 14:48 UTC");
new Date(1317826080); // Unix Timestamp for 05 October 2011 14:48:00 UTC
```

See also
--------

* `Date`
* `Date.prototype.parse()`
* `Date.prototype.toISOString()`
RangeError: precision is out of range
=====================================

 The JavaScript exception "precision is out of range" occurs when a number that's
 outside of the range of 0 and 20 (or 21) was passed into `toFixed` or
 `toPrecision`.

Message
-------
```

RangeError: toExponential() argument must be between 0 and 100 (V8-based & Safari)
RangeError: toFixed() digits argument must be between 0 and 100 (V8-based & Safari)
RangeError: toPrecision() argument must be between 1 and 100 (V8-based & Safari)
RangeError: precision -1 out of range (Firefox)
```

Error type
----------

`RangeError`What went wrong?
----------------

There was an out of range precision argument in one of these methods:

* `Number.prototype.toExponential()`, which requires the arguments to be between 0 and 100, inclusive.
* `Number.prototype.toFixed()`, which requires the arguments to be between 0 and 100, inclusive.
* `Number.prototype.toPrecision()`, which requires the arguments to be between 1 and 100, inclusive.
Examples
--------

### Invalid cases


```js
(77.1234).toExponential(-1); // RangeError
(77.1234).toExponential(101); // RangeError

(2.34).toFixed(-100); // RangeError
(2.34).toFixed(1001); // RangeError

(1234.5).toPrecision(-1); // RangeError
(1234.5).toPrecision(101); // RangeError
```

### Valid cases


```js
(77.1234).toExponential(4); // 7.7123e+1
(77.1234).toExponential(2); // 7.71e+1

(2.34).toFixed(1); // 2.3
(2.35).toFixed(1); // 2.4 (note that it rounds up in this case)

(5.123456).toPrecision(5); // 5.1235
(5.123456).toPrecision(2); // 5.1
(5.123456).toPrecision(1); // 5
```

See also
--------

* `Number.prototype.toExponential()`
* `Number.prototype.toFixed()`
* `Number.prototype.toPrecision()`
ReferenceError: deprecated caller or arguments usage
====================================================

 The JavaScript strict mode-only exception
 "deprecated caller or arguments usage" occurs when the
 deprecated `Function.prototype.caller` or `Function.prototype.arguments` properties
 are used.

Message
-------
```

TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them (V8-based & Firefox)
TypeError: 'arguments', 'callee', and 'caller' cannot be accessed in this context. (Safari)
```

Error type
----------

`TypeError` in strict mode only.

What went wrong?
----------------

 In strict mode, the
 `Function.prototype.caller` or `Function.prototype.arguments` properties are used
 and shouldn't be. They are deprecated, because they leak the function caller, are
 non-standard, hard to optimize and potentially a performance-harmful feature.

Examples
--------

### Deprecated function.caller or arguments.callee

`Function.prototype.caller` and
 `arguments.callee`
 are deprecated (see the reference articles for more information).


```js
"use strict";

function myFunc() {
  if (myFunc.caller === null) {
    return "The function was called from the top!";
  } else {
    return `This function's caller was ${myFunc.caller}`;
  }
}

myFunc();
// TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
```

### Function.prototype.arguments

`Function.prototype.arguments` is deprecated (see the reference article for more
 information).


```js
"use strict";

function f(n) {
  g(n - 1);
}

function g(n) {
  console.log(`before: ${g.arguments[0]}`);
  if (n > 0) {
    f(n);
  }
  console.log(`after: ${g.arguments[0]}`);
}

f(2);

console.log(`returned: ${g.arguments}`);
// TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
```

See also
--------

* Deprecated and obsolete features
* Strict mode
* `Function.prototype.arguments`
* `Function.prototype.caller`
* `arguments.callee`
isFinite()
==========

The **`isFinite()`** function determines whether a value is finite, first converting the value to a number if necessary. A finite number is one that's not `NaN` or ±`Infinity`. Because coercion inside the `isFinite()` function can be surprising, you may prefer to use `Number.isFinite()`.

Try it
------

Syntax
------


```js
isFinite(value)
```

### Parameters

`value`

The value to be tested.

### Return value

`false` if the given value is `NaN`, `Infinity`, or `-Infinity` after being converted to a number; otherwise, `true`.

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

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

When the argument to the `isFinite()` function is not of type Number, the value is first coerced to a number, and the resulting value is then compared against `NaN` and ±Infinity. This is as confusing as the behavior of `isNaN` — for example, `isFinite("1")` is `true`.

`Number.isFinite()` is a more reliable way to test whether a value is a finite number value, because it returns `false` for any non-number input.

Examples
--------

### Using isFinite()


```js
isFinite(Infinity); // false
isFinite(NaN); // false
isFinite(-Infinity); // false

isFinite(0); // true
isFinite(2e64); // true
isFinite(910); // true

// Would've been false with the more robust Number.isFinite():
isFinite(null); // true
isFinite("0"); // true
```

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

| Specification |
| --- |
| ECMAScript Language Specification # sec-isfinite-number |

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

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

See also
--------

* `Number.isFinite()`
* `Number.NaN`
* `Number.POSITIVE_INFINITY`
* `Number.NEGATIVE_INFINITY`
Uint8Array
==========

The **`Uint8Array`** typed array represents an array of 8-bit unsigned integers. 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).

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

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

`Uint8Array()`

Creates a new `Uint8Array` object.

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

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

`Uint8Array.BYTES_PER_ELEMENT`

Returns a number value of the element size. `1` in the case of `Uint8Array`.

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

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

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

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

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

`Uint8Array.prototype.BYTES_PER_ELEMENT`

Returns a number value of the element size. `1` in the case of a `Uint8Array`.

`Uint8Array.prototype.constructor`

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

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

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

Examples
--------

### Different ways to create a Uint8Array


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

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

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

// From an ArrayBuffer
const buffer = new ArrayBuffer(8);
const z = new Uint8Array(buffer, 1, 4);
console.log(z.byteOffset); // 1

// From an iterable
const iterable = (function\* () {
  yield\* [1, 2, 3];
})();
const uint8FromIterable = new Uint8Array(iterable);
console.log(uint8FromIterable);
// Uint8Array [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 `Uint8Array` in `core-js`
* JavaScript typed arrays guide
* `TypedArray`
* `ArrayBuffer`
* `DataView`
unescape()
==========

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

**Note:** `unescape()` is a non-standard function implemented by browsers and was only standardized for cross-engine compatibility. It is not required to be implemented by all JavaScript engines and may not work everywhere. Use `decodeURIComponent()` or `decodeURI()` if possible.

The **`unescape()`** function computes a new string in which hexadecimal escape sequences are replaced with the characters that they represent. The escape sequences might be introduced by a function like `escape()`.

Syntax
------


```js
unescape(str)
```

### Parameters

`str`

A string to be decoded.

### Return value

A new string in which certain characters have been unescaped.

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

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

The `unescape()` function replaces any escape sequence with the character that it represents. Specifically, it replaces any escape sequence of the form `%XX` or `%uXXXX` (where `X` represents one hexadecimal digit) with the character that has the hexadecimal value `XX`/`XXXX`. If the escape sequence is not a valid escape sequence (for example, if `%` is followed by one or no hex digit), it is left as-is.

**Note:** This function was used mostly for URL encoding and is partly based on the escape format in RFC 1738. The `unescape()` function does *not* evaluate escape sequences in string literals. You can replace `\xXX` with `%XX` and `\uXXXX` with `%uXXXX` to get a string that can be handled by `unescape()`.

Examples
--------

### Using unescape()


```js
unescape("abc123"); // "abc123"
unescape("%E4%F6%FC"); // "äöü"
unescape("%u0107"); // "ć"
```

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

| Specification |
| --- |
| ECMAScript Language Specification # sec-unescape-string |

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

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

See also
--------

* Polyfill of `unescape` in `core-js`
* `decodeURI`
* `decodeURIComponent`
* `escape`