resposta rápida do código javascript [closed]
Por que isso não funciona? Eu estou tentando agora por um longo tempo e parece que não há fim para isso. Precisa simplificar ao máximo
var firstInput = document.luckForm.numberBox.value;
var secondInput = document.luckForm.numberBox2.value;
var thirdInput = document.luckForm.numberBox3.value;
for (firstInput = 0; firstInput <= 10; firstInput++) {
if (firstInput = luckyNumber) {
if (secondInput = luckyNumber2) {
if (thirdInput = luckyNumber3) {
{alert('Congratulations! You got all 3 numbers correct. You\'ve won £1000!'); }}}}}
Eu estava tentando mudar este código (veja abaixo) em um código for loop, muito simples, sem matrizes. Não tenho certeza de como posso fazer isso. É suposto ser para uma loteria, você pode digitar três números e se eles estiverem corretos, você receberá a mensagem de que você ganha 1000 libras.
if (firstInput == luckyNumber && secondInput == luckyNumber2 && thirdInput == luckyNumber3 || firstInput == luckyNumber && secondInput == luckyNumber3 && thirdInput == luckyNumber2 || firstInput == luckyNumber2 && secondInput == luckyNumber3 && thirdInput == luckyNumber || firstInput == luckyNumber2 && secondInput == luckyNumber && thirdInput == luckyNumber3 || firstInput == luckyNumber3 && secondInput == luckyNumber && thirdInput == luckyNumber2 || firstInput == luckyNumber3 && secondInput == luckyNumber2 && thirdInput == luckyNumber)
{
alert('Congratulations! You got all 3 numbers correct. You\'ve won £1000!');