W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>JavaScript 字符串方法</h1> <p id="demo"></p> <script> var str = "Hello"; var arr = str.split(""); var text = ""; var i; for (i = 0; i < arr.length; i++) { text += arr[i] + "<br>" } document.getElementById("demo").innerHTML = text; </script> </body> </html>