TypedArray join() JavaScript

The Javascript TypedArray join() method combines all the elements of an Array into a string. The specified separator will separate all elements. The default separator is a comma(,).

Syntax:

array.join(separator)

Parameters: separator: It represents the separator to which all elements will be separated. It is optional

Returns: It returns a string which combines all the elements of an Array.

Example 1:

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">   
var Jewels = ["DIAMOND","GOLD","PLATINUM","SILVER"];
document.write(Jewels.join('.'));   
</script>
</body>
</html>

Example 2:

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript"> 
const testArray = new Uint8Array([34, 12, 56, 12, 89]);
 
document.write(testArray.join());
document.write("</br>");
 
document.write(testArray.join(''));
document.write("</br>");
 
document.write(testArray.join('-'));
 
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com