W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h2>JavaScript For Of 循环</h2> <p>for of 语句循环遍历可迭代对象的值。</p> <p id="demo"></p> <script> let language = "JavaScript"; let text = ""; for (let x of language) { text += x + "<br>"; } document.getElementById("demo").innerHTML = text; </script> </body> </html>