<html>
<head>
<meta charset="utf-8">
<title>手册网教程(shouce.ren)</title>
</head>
<body>
<p>点击按钮使用 “Shouce” 填充所有数组元素。</p>
<button onclick="myFunction()">点我</button>
<p id="demo"></p>
<p><strong>注意:</strong> IE 11 及更早版本不支持 fill() 方法。</p>
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits;
function myFunction() {
document.getElementById("demo").innerHTML = fruits.fill("Shouce");
}
</script>
</body>
</html>