我被困在某物上。我希望用户能够从数组中选择一个值。但挑战是他/她无法获得与之前相同的价值。每次获得不同的随机值
https://jsbin.com/hibihubega/edit?html,js,console,output
我不知道如何着手,帮助。
function getNum(){
var num = ['1', '2', '3', '4', '5'];
var selected = num[Math.floor(Math.random() * num.length)];
var history = selected;
if(history){
}
}
$('button').click(function(){
console.log(getNum());
})
选择后从数组中删除的元素。 – Tempux