UNB/ CS/ David Bremner/ teaching/ cs2613/ books/ mdn/ Reference/ Global Objects/ TypedArray/ TypedArray.prototype.join()

The join() method of TypedArray instances creates and returns a new string by concatenating all of the elements in this typed array, separated by commas or a specified separator string. If the typed array has only one item, then that item will be returned without using the separator. This method has the same algorithm as Array.prototype.join.

Syntax

join()
join(separator)

Parameters

Return value

A string with all typed array elements joined. If array.length is 0, the empty string is returned.

Description

See Array.prototype.join for more details. This method is not generic and can only be called on typed array instances.

Examples

Using join()

const uint8 = new Uint8Array([1, 2, 3]);
uint8.join(); // '1,2,3'
uint8.join(" / "); // '1 / 2 / 3'
uint8.join(""); // '123'

Specifications

Browser compatibility

See also