var randomNum = Math.random();
if(randomNum<0.5){
console.log("it will always be me.");
console.log(randomNum);
}
else if(randomNum>=0.5){
**//what do I do here to repeat the Math.random process until the number is below 0.5?**
}
我是使用 JavaScript 的新手,我似乎无法弄清楚如何做到这一点。I want it to work so that when a number above 0.5 is picked, it repeats the Math.random process without doing anything else until a number below 0.5 is picked. 所以最后它总是会显示“它永远是我。”,以及被选中的数字。这可能吗?如果是这样,有人可以告诉我该怎么做吗?