Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

E index.js 1 var randomNumber1 = Math.floor(Math.random() * 6) + 1; //1-6 Nm 4 var randomDice Image dice + randomNumber1 + .png; //dice1.png dice6.png 5

image text in transcribed

E index.js 1 var randomNumber1 = Math.floor(Math.random() * 6) + 1; //1-6 Nm 4 var randomDice Image "dice" + randomNumber1 + ".png"; //dice1.png dice6.png 5 6 var random ImageSource = "images/" + randomDiceImage; //images/dice1.png - images/dice6.png 7 8 9 var image1 = document.querySelectorall("img")[0]; 10 image1.setAttribute("src", random ImageSource); 11 12 13 var randomNumber2 = Math.floor(Math.random() 6) + 1; 14 15 var random ImageSource2 = "images/dice" + randomNumber2 + ".png"; 16 17 18 19 document.querySelectorall("img")[1].setAttribute("src", random Image Source2); 20 var randomNumber3 = Math.floor(Math.random() * 6) + 1; 21 22 23 var random ImageSource "images/dice" + randomNumber3 + ".png"; 24 document.querySelectorall("img")[2].setAttribute("src", random ImageSource3); 25 26 27 //Complete the code here for Question 2 //If the # on Dice 1 or Dice 2 or Dice 3 equals 6, display "We have a Super Winner". Note that more than one dice can display a 6, but at least one should! // If the # on Dice 1 + # on Dice 2 + # on Dice 3 - 7, then display "All three are Super Winners" 28 29 30 31 32 33 34 35 //If player 1 wins if (randomNumberal > randomNumber2 && randomNumber1 > randomNumber3) { | document.querySelector("h1").innerHTML = "We have a Super Winner"; } else if (randomNumber1 randomNumber3) { document.querySelector("h1").innerHTML = "We have a Super Winner"; } 36 37 38 39 else if (randomNumber3 > randomNumber1 && randomNumber3 > randomNumber2) { document.querySelector("h1").innerHTML = "We have a Super Winner"; AA 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions