Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

TypedArray.prototype.join()

BaselineWidely available

Thejoin() method ofTypedArray 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 asArray.prototype.join().

Try it

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
join()join(separator)

Parameters

separatorOptional

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. Ifarray.length is0, the empty string is returned.

Description

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

Examples

Using join()

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

Specifications

Specification
ECMAScript® 2026 Language Specification
# sec-%typedarray%.prototype.join

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp