Standard built-ins

Uint8Array

Try the free JavaScript compiler

Creates byte elements converted to unsigned eight-bit integers.

Formal Syntax & Structure

javascript syntaxjavascript
new Uint8Array(iterable)

Parameters & Attributes

NameTypeDescription
iterableIterable<number>Initial numeric elements; other constructor overloads exist.

Return Value

Uint8Array

Creates byte elements converted to unsigned eight-bit integers.

Working Example

Example Snippetjavascript
(async () => {const a=new Uint8Array([-1,256,260]);console.log(JSON.stringify([...a]));})()
JavaScript Reference