Question: Please help I can't figure out how to repeat the program for 5 guesses and then display the status after running the start game and
Please help I can't figure out how to repeat the program for guesses and then display the status after running the start game and check answer codes.
Please tell me how to adjust this code.
const words happy"lose","great","zainy","juice","point","grapes";
let pickedWord;
let guesses ;
function startGame
const hintsa wonderful feeling",
"didn't win",
"a feeling of mighty",
"a crazy idea",
"quenches your thirst",
"pencil tip",
"green and purple fruit";
const arrayIndex MathfloorMathrandom words.length;
pickedWordwordsarrayIndex;
const pickedHinthintsarrayIndex;
document.getElementByIdhintTextinnerHTML pickedHint;
document.getElementByIdpickedWordvalue pickedWord;
function checkAnswer
let correctAnswers;
let userGuess document.getElementByIdguessedWordvalue;
console.loguserGuess;
ifuserGuess pickedWord
correctAnswers ;
alertYou are right. correctAnswers "number of right answers.";
else
alertPlease try again.";
let status;
switch correctAnswers
case :
status"You are a pro";
break;
case :
status"You are becoming experienced";
break;
default:
status"You need more work.Try again";
break;
document.getElementByIdgameResultsinnerHTML status;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
