typedArray.join(separator) joins all the elements into one string. Between two elements it puts the separator; the default is a comma. The elements are written as numbers, so new Uint8Array([1, 2, 3]).join() is "1,2,3". An empty typed array gives an empty string. It is the best way to print a typed array in a clear and portable way, because every engine gives the same text.
The separator is optional. Without it, a comma is used.
JavaScript
typedArray.join()
typedArray.join(separator)
Call
What it does
ta.join()
Join with commas: "1,2,3".
ta.join(" - ")
Join with any text you choose between the elements.
ta.join("")
Glue the numbers together with nothing in between.
Built into JavaScript since ES2015 on all 11 typed array types. BigInt arrays work too: new BigInt64Array([1n, 2n]).join("+") is "1+2".
Library declarations
JavaScript
TypedArray.prototype.join(separator) // returns a string
// separator: undefined -> "," (anything else is turned into a string)
// elements are written like String(element)
// an empty typed array returns ""
Parameters
Parameter
Description
separator (optional)
The text put between two elements. If it is missing or undefined, a comma is used. Other values are converted to a string, so null gives the text "null", and 0 gives "0".
Return Value
Return Value
Description
String
One string with the elements in order, separated by the separator. An empty array gives "". It is the same idea as Array join().
JavaScript Examples
Example 1 — Choose the Separator
Three bytes are joined in different ways. The last line shows that an empty typed array gives an empty string.
The stored value is shown. A Float32Array cannot hold 0.1 exactly, so join() prints the nearest single-precision number. Minus zero prints as plain 0.
Special numbers have names.NaN and Infinity are written as those words, with the slash separator between them.
Separators become text. BigInts print without the n, and null as a separator is turned into the four letters "null".
Compatibility
Browser & Runtime Support
TypedArray.prototype.join() is part of ES2015 (ES6), together with typed arrays and the other array-like methods.
✓ Baseline · ES2015
TypedArray.prototype.join()
Supported in every modern browser, plus Node.js, Deno, and Bun.
98%Modern browser support
Google ChromeAll modern versions
Full support
Mozilla FirefoxAll modern versions
Full support
Apple SafariAll modern versions
Full support
Microsoft EdgeAll modern versions
Full support
Node.jsAll current releases
Supported
DenoAll releases
Supported
Internet ExplorerIE 10 and 11 have typed arrays, but not this method
Not supported
join()Excellent
Bottom line: Safe everywhere modern JavaScript runs. Internet Explorer 10 and 11 have typed arrays but not this method, so join a plain Array there.
Frequently Asked Questions
One string with all the elements written as numbers and the separator between them. An empty typed array gives an empty string.
A comma, written without a space. For example, new Uint8Array([1, 2, 3]).join() gives "1,2,3". Pass " " or ", " when you want spaces.
console.log(ta) prints a different format in Node.js and in browsers. ta.join(" ") gives the same plain text everywhere, so examples and output always match.
No. It only reads the elements and returns a new string. The typed array keeps its values and its length.
Split it and convert: Uint8Array.from("1,2,3".split(","), Number). Typed arrays do not have a method that parses text directly.