<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>js实现repeat方法</title>
</head>
<body>
<p>点击显示'javascript'</p>
<p id="showrepeat"></p>
<button onclick="showfunc()">点击显示</button>
</body>
<script>
function showfunc(){
var str='JAVASCRIPT,'
document.getElementById('showrepeat').innerHTML=str.repeat(3);
}
</script>
</html>
js实现一个repeat(重复)方法
最新推荐文章于 2022-10-20 16:21:47 发布