ฟังก์ชัน 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