เมธอด keys() ของ TypedArray ส่งคืนออบเจ็กต์ Iterator ที่มีดัชนี (index) ของแต่ละองค์ประกอบใน typed array
ไวยากรณ์ (Syntax)
typedArray.keys()
ตัวอย่าง
<html> <head> <title>ตัวอย่าง JavaScript</title> </head> <body> <script type="text/javascript"> var int32View = new Int32Array([21, 64, 89, 65, 33, 66, 87, 55]); document.write("เนื้อหาของ typed array: "+int32View); document.write("<br>"); var it = int32View.keys(); for(i=0; i<int32View.length; i++) { document.writeln(it.next().value); } </script> </body> </html>
ผลลัพธ์
เนื้อหาของ typed array: 21,64,89,65,33,66,87,55 0 1 2 3 4 5 6 7