Documentación offline JavaScript main

TypedArray.prototype.join()

main Documentación oficial Licencia CC-BY-SA-2.5Descargado el 2026-08-02

En esta página

The join() method of {{jsxref("TypedArray")}} instances returns a new string that is the concatenation of all elements in this typed array, separated by commas or a specified separator string. If the typed array has only one item, that item's stringification is returned without using the separator. This method has the same algorithm as {{jsxref("Array.prototype.join()")}}.

{{InteractiveExample("JavaScript Demo: TypedArray.prototype.join()")}}

```js interactive-example const uint8 = new Uint8Array([10, 20, 30, 40, 50]);

console.log(uint8.join()); // Expected output: "10,20,30,40,50"

console.log(uint8.join("")); // Expected output: "1020304050"

console.log(uint8.join("-")); // Expected output: "10-20-30-40-50"

## Syntax

```js-nolint
join()
join(separator)

Parameters#

  • separator {{optional_inline}}
  • : A string to separate each pair of adjacent elements of the typed array. If omitted, the typed array elements are separated with a comma (",").

Return value#

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

Description#

See {{jsxref("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#

{{Specifications}}

Browser compatibility#

{{Compat}}

See also#