源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> </head> <body> <h2>JavaScript let</h2> <p id="demo"></p> <script> var i = 5; for (let i = 0; i < 10; i++) { // 一些代码... } document.getElementById("demo").innerHTML = i; </script> </body> </html>
运行结果