Skip to content
Related Articles

Related Articles

JavaScript | typedArray.join() with Example

View Discussion
Improve Article
Save Article
  • Last Updated : 24 Jul, 2018
View Discussion
Improve Article
Save Article

The typedArray.join() is an inbuilt function in JavaScript which is used to join all the elements of the given typedArray into a string.


Parameters: It accepts a parameter “separator” which is used to separate each element of the typedArray. It is optional and its default value is comma (‘,’).

Return value: It returns a string containing all the joined elements.
JavaScript code to show the working of this function:

  // Creating some typedArrays
  const A = new Uint8Array([1, 2, 3, 4, 5]);
  const B = new Uint8Array([5, 10, 15, 20]);
  const C = new Uint8Array([0, 2, 4, 6, ,8, 10]);
  const D = new Uint8Array([1, 3, 5, 7, 9]);
   // Calling join() function
   a = A.join()
   b = B.join('/')
   c = C.join('+')
   d = D.join('&')
   // Printing new strings with joined elements
   document.write(a +"<br>");
   document.write(b +"<br>");
   document.write(c +"<br>");


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!