---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# BigInt()

The **`BigInt()`** function returns a value of type **bigint**.

## Syntax

```js
BigInt(value)
```

> **Note:** `BigInt()` can only be called without `new`. Attempting to construct it with `new` throws a [`TypeError`](../../globals/TypeError/TypeError.mdx).

### Parameters

- `value`
  - : The numeric value of the object being created. It may be a string, an integer, a boolean, or another `BigInt`.

### Return value

A `BigInt` value. Number values must be integers and are converted to BigInts. The boolean value `true` becomes `1n`, and `false` becomes `0n`. Strings are parsed as if they are source text for integer literals, which means they can have leading and trailing whitespaces and can be prefixed with `0b`, `0o`, or `0x`.

### Exceptions

- [`RangeError`](../../globals/RangeError/RangeError.mdx)
  - : Thrown if the parameter is a non-integral number.
- [`TypeError`](../../globals/TypeError/TypeError.mdx)
  - : Thrown if at least one of these conditions is met:
    - The parameter cannot be converted to a primitive.
    - After conversion to a primitive, the result is [`undefined`](../undefined.mdx), `null`, `Symbol`.
- [`SyntaxError`](../SyntaxError/SyntaxError.mdx)
  - : Thrown if the parameter is a string that cannot be parsed as a `BigInt`.
