The for...in loop is used to loop through an object's properties. Let’s see a for…in statement to loop through an array.
Example
You can try to run the following code to learn how to use the for…in statement to loop through an array −
Live Demo
<html> <body> <script> var items = new Array('Hello', 'World'); var i = 0; for (var i in items) { document.write(items[i]); } </script> </body> </html>