JavaScript Create a function called playGame(). Create a function-scoped variable that gets a random number between (and including) 1 and 100. Make sure your result does not include 0 (zero). Create a...

1 answer below »

JavaScript



  • Create a function called playGame().

  • Create a function-scoped variable that gets a random number between (and including) 1 and 100. Make sure your result does not include 0 (zero).

  • Create a variable called min and set it to 50.

  • Create a variable called max and set it to 75.

  • Then write an if/else statement that follows the following logic:


    • If the random number is greater than the minimum variable and less than the maximum variable, then send a message to HTML that saysYour Number: #, You Won!(the # should be replaced with the randomly generated number. If it doesn't fall within those parameters, then the message in HTML should sayYour Number: #, Keep Trying!




Your final output should look like this...









Lesson 6 JavaScript · Create a function called playGame(). · Create a function-scoped variable that gets a random number between (and including) 1 and 100. Make sure your result does not include 0 (zero). · Create a variable called min and set it to 50. · Create a variable called max and set it to 75. · Then write an if/else statement that follows the following logic:  · If the random number is greater than the minimum variable and less than the maximum variable, then send a message to HTML that says Your Number: #, You Won! (the # should be replaced with the randomly generated number. If it does not fall within those parameters, then the message in HTML should say Your Number: #, Keep Trying!   Your final output should look like this...  Submit Your Work
Answered 1 days AfterJun 30, 2021

Answer To: JavaScript Create a function called playGame(). Create a function-scoped variable that gets a random...

Kshitij answered on Jul 02 2021
145 Votes
RandomWin/index.html


RANDOM NUMBER
RandomWin/script.js
var min = 50;
var m
ax = 75;
function playGame() {
var val = Math.floor(Math.random() * 100) + 1;
var result = "";
if (val > 50 && val < 70) {
result = "Your number is " + val + " You won!!! ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here