Knowee
Questions
Features
Study Tools

remove the alert from part 2, you don't need it anymoremake a variable outside of all functions called numGamesdefine another function called setNumberOfGames. Attach it to the button for choosing the number of games. It should find the input where the user chose their number of games, and store the number in numGamesIt should also put that number in the innerHTML of the paragraph on the bottom of the page.Go back to the takeTurn function. In it, every time the function is called, the numGames variable should go down by 1 and the new value should go in the paragraph at the bottom of the pageYou are done if the button set the number at the bottom of the page, and clicking rock, paper, or scissors, reduces that number by 1 each time.

Question

remove the alert from part 2, you don't need it anymoremake a variable outside of all functions called numGamesdefine another function called setNumberOfGames. Attach it to the button for choosing the number of games. It should find the input where the user chose their number of games, and store the number in numGamesIt should also put that number in the innerHTML of the paragraph on the bottom of the page.Go back to the takeTurn function. In it, every time the function is called, the numGames variable should go down by 1 and the new value should go in the paragraph at the bottom of the pageYou are done if the button set the number at the bottom of the page, and clicking rock, paper, or scissors, reduces that number by 1 each time.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

This text appears to be written in JavaScript, a programming language. Here's how you can implement the instructions:

  1. Remove the alert from part 2:
// Assuming the alert is in a function, it would look something like this:
function someFunction() {
    // alert('Some message'); // Comment out or delete this line
}
  1. Define a variable outside of all functions called numGames:
let numGames;
  1. Define another function called setNumberOfGames:
function setNumberOfGames() {
    let input = document.querySelector('#input-id'); // Replace '#input-id' with the actual id of your input element
    numGames = parseInt(input.value);
    let paragraph = document.querySelector('#paragraph-id'); // Replace '#paragraph-id' with the actual id of your paragraph element
    paragraph.innerHTML = numGames;
}
  1. Attach setNumberOfGames to the button for choosing the number of games:
let button = document.querySelector('#button-id'); // Replace '#button-id' with the actual id of your button element
button.addEventListener('click', setNumberOfGames);
  1. Modify the takeTurn function:
function takeTurn() {
    numGames--;
    let paragraph = document.querySelector('#paragraph-id'); // Replace '#paragraph-id' with the actual id of your paragraph element
    paragraph.innerHTML = numGames;
}
  1. Attach takeTurn to the buttons for rock, paper, or scissors:
let rockButton = document.querySelector('#rock-button-id'); // Replace '#rock-button-id' with the actual

This problem has been solved

Similar Questions

make a variable outside of all functions called numGamesdefine another function called setNumberOfGames. Attach it to the button for choosing the number of games. It should find the input where the user chose their number of games, and store the number in numGamesIt should also put that number in the innerHTML of the paragraph on the bottom of the page.Go back to the takeTurn function. In it, every time the function is called, the numGames variable should go down by 1 and the new value should go in the paragraph at the bottom of the pageYou are done if the button set the number at the bottom of the page, and clicking rock, paper, or scissors, reduces that number by 1 each time.

Go back to the takeTurn function. In it, every time the function is called, the numGames variable should go down by 1 and the new value should go in the paragraph at the bottom of the pageYou are done if the button set the number at the bottom of the page, and clicking rock, paper, or scissors, reduces that number by 1 each time.

rt 2Make the following variables (all of them should be OUTSIDE OF EVERY FUNCTION ON TOP OF MAIN.JS), along with the variables I left for you containing images: computerNumber, start it with -1 or any other numberdefine a function and attach it to each of your buttons (and/or to the user hitting the enter key). Call it takeTurn. This function should take a parameter. 1 for rock, 2 for paper, 3 for scissors:each button should have a function call with a different number passed in as a parameter based on how the function should expect numbersIn the function, reassign computerNumber to a random number between 1 and 3 (use randomInt() )Also put two alerts, one to show the user's number (representing which button they pushed) and one to show the computer's random numberYou are done when the alert in the function works correctly

Create In your HTML:a heading that says "Play Rock Paper Scissors"a paragraph underneath it with an input tag and a button in it. The paragraph should say "How many games would you like to play?" then the input, then a button that says "choose number of games"another paragraph that contains three buttons, one that says Rock, one that says paper, one that says scissorsa table with 2 rows and 3 boxes in each rowA paragraph that says "Games to play"A paragraph that says "0"Style it up nicely so it looks goodYou are done when you have all of this

Make the following variables (all of them should be OUTSIDE OF EVERY FUNCTION ON TOP OF MAIN.JS), along with the variables I left for you containing images: num1 a random number between 0 and 9num2 a random number between 0 and 9num3 a random number between 0 and 9totalGuesses start it with a 0use randomInt()define a function and attach it to your button (and/or to the user hitting the enter key). Call it makeGuess. This function should:find what the user typed in the inputs for each number, store it in a variable called userGuessclear the inputsalert all three of the user numbers so you can see it is workingYou are done when the alert in the function works correctly

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.