---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# Uint8Array

The **`Uint8Array()`** constructor creates a typed 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).

## Syntax

```js
new Uint8Array()
new Uint8Array(length)
new Uint8Array(typedArray)
new Uint8Array(object)

new Uint8Array(buffer)
new Uint8Array(buffer, byteOffset)
new Uint8Array(buffer, byteOffset, length)
```

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

### Parameters

See [`TypedArray`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#parameters).

### Exceptions

See [`TypedArray`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#exceptions).
