Code:`<html>`

<head>

</head>

<body>

<script type="text/javascript">

var randomNumber1 = Math.round(Math.random() * 1)

var randomNumber2 = Math.round(Math.random() * 1)

var chances = 5

function Random(){

if(Numbers.Guess1.value != randomNumber1 && Numbers.Guess2.value != randomNumber2 )

{

document.write("Numbers generated are: " + randomNumber1 + " and " + randomNumber2)

document.write("<br>You win!")

}

else(Numbers.Guess1.value == randomNumber1 && Numbers.Guess2.value == randomNumber2 )

{

document.write("Numbers generated are: " + randomNumber1 + " and " + randomNumber2)

document.write("<br>You lose!")

}

}

</script>

<form name=Numbers>

<input type="text" name=Guess1>Enter your Number 1!<br>

<input type="text" name=Guess2>Enter your Number 2!<br>

<input type=button value="Confirm Number" onClick="Random()">

</form>

</body>

</html>

Also could you help with the chances part I'm new to JavaScript as I am a first year student. Will be really appreciated.Quote:

Should be like this:

Enter number: 10

Enter number: 15

Number generated as 3 and 3

You have lost

You have 2 chance(s) left to play the game

---

Enter number: 2

Enter number: 0

Number generated as 0 and 3

You have lost

You have 1 chance(s) left to play the game

---

Enter number: 2

Enter number: 2

Number generated as 1 and 3

You have lost

Unfortunately there are no more chances, have a nice day

---

Enter number: 2

Enter number: 3

Number generated as 2 and 3

Congratulations you have won

Have a fantastic day!

---