join()
TypedArray对象的函数将类型化数组的内容作为单个字符串连接起来并返回它。对于此方法,您可以传递分隔符以分隔数组的元素。
其语法如下
typedArray.join(':')
<html> <head> <title>JavaScript Array every Method</title> </head> <body> <script type="text/javascript"> var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55 ]); document.write("<br>"); var contains = int32View.join(''); document.write("."+contains); document.write("<br>"); document.write(int32View.join(':')); document.write("<br>"); document.write(int32View.join('-')); document.write("<br>"); document.write(int32View.join(' ')); </script> </body> </html>
输出结果
: 2119652114668755 21:19:65:21:14:66:87:55 21-19-65-21-14-66-87-55 21 19 65 21 14 66 87 55