Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript ES6 for...of Loop</title> </head> <body> <script> // Iterating over array let letters = ["a", "b", "c", "d", "e", "f"]; for(let letter of letters) { document.write(letter + "<br>"); // a,b,c,d,e,f } document.write("<hr>"); // Iterating over string let greet = "Hello World!"; for(let character of greet) { document.write(character + "<br>"); // H,e,l,l,o, ,W,o,r,l,d,! } </script> </body> </html>