切换布局
显示结果
<html> <head> <title>JavaScript String repeat Method</title> </head> <body> <p>点击按钮显示复制连接后的字符串。</p> <button onclick="myFunction()">点我</button> <p id="demo"></p> <p><strong>注意:</strong> IE 11 及更早版本不支持 repeat() 方法 。</p> <script> function myFunction() { var str = "Jiyik"; document.getElementById("demo").innerHTML = str.repeat(2); } </script> </body> </html>