随机抽奖
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<button>点击抽奖</button>
</body>
</html>
<script>
let btn=document.getElementsByTagName('button')[0]
let num=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30]
btn.onclick=function () {
let a = parseInt(Math.random() * num.length)
console.log(num[a])
num.splice(a, 1)
}
</script>