if(resultArray.includes(result))
{
pickRandom();
}
if (resultArray.length === max)
{
alert("you ran out of number");
}
else
{
resultArray.push(result);
document.getElementById("result").value = result;
}
hi guys... I can't understand the logic behind this
I have 2 IFs statements, but in this case if I put the resultArray.length === max IF statement in second, it will result in undesirable result such as being triggered before all 48 numbers were randomly picked
if I put the resultArray.length === max IF statement first, then it will pick all 48 numbers before alerting...
Aucun commentaire:
Enregistrer un commentaire