Typed Array toString()
Example
// Create a Typed Array
const myArr = Int32Array.of(40, 100, 1, 5, 25, 10);
// Convert the Array to a String
let text = myArr.toString();
Try it Yourself »
Description
The toString()
method returns a string with array values separated by commas.
The toString()
method does not change the original array.
Note
Every JavaScript object has a toString()
method.
The toString()
method is used internally by JavaScript
when an object needs to be displayed as a text (like in HTML),
or when an object needs to be used as a string.
Syntax
typed-array.toString()
Parameters
NONE |
Return Value
Type | Description |
String | The array values separated by commas. |
JavaScript Typed Arrays
Browser Support
typed-array.toString()
is an ECMAScript6 (ES6 2015) feature.
JavaScript 2015 is fully supported in all modern browsers since June 2017:
Chrome 51 | Edge 15 | Firefox 54 | Safari 10 | Opera 38 |
May 2016 | Apr 2017 | Jun 2017 | Sep 2016 | Jun 2016 |