<!DOCTYPE html>
<html>
<body>
<h1>JavaScript 配列</h1>
<h2>sort()メソッド</h2>
<p>ボタンを(何度も)クリックして、配列をランダムな順序で並べ替えます。</p>
<button onclick="myFunction()">試してみる</button>
<p id="demo"></p>
<script>
const points = [40, 100, 1, 5, 25, 10];
document.getElementById("demo").innerHTML = points;
function myFunction() {
points.sort(function(){return 0.5 - Math.random()});
document.getElementById("demo").innerHTML = points;
}
</script>
</body>
</html>