i have a big problem in javascript and i don't know how to solve it
i'm trying to complete a javascript programming assignment and i am stuck
this is the program description :
New Number Mastermind is a game where you try to guess a 4 digit number. After each guess, you are told how many digits are correct and in the correct position, and how many are correct and in the wrong position. The fewer the number of guesses, the better.
You are to write a JavaScript program to play New Number Mastermind. Use math.random() to generate a digit in the range 1 to 6. Repeat this to get all four digits. Then ask the user to enter four digits, each in the range 1 to 6. Compare the guessed digits with the randomly generated digits and tell the user how many digits are correct. That is; first, correct in the right position and then correct, but in the wrong position. If the guess is completely correct congratulate the user and tell them how many guesses they have made. If the guess is not completely correct let the user see all previous guesses and results before they make their next guess.
i know how to use math.random and math.floor
but i don't understand how i can compare the guesses and game generated by the computer in a way that i can say number one is correct but in the wrong position or number one is correct and so on for the other numbers. please help and sorry if i have bothered you
i'm trying to complete a javascript programming assignment and i am stuck
this is the program description :
New Number Mastermind is a game where you try to guess a 4 digit number. After each guess, you are told how many digits are correct and in the correct position, and how many are correct and in the wrong position. The fewer the number of guesses, the better.
You are to write a JavaScript program to play New Number Mastermind. Use math.random() to generate a digit in the range 1 to 6. Repeat this to get all four digits. Then ask the user to enter four digits, each in the range 1 to 6. Compare the guessed digits with the randomly generated digits and tell the user how many digits are correct. That is; first, correct in the right position and then correct, but in the wrong position. If the guess is completely correct congratulate the user and tell them how many guesses they have made. If the guess is not completely correct let the user see all previous guesses and results before they make their next guess.
i know how to use math.random and math.floor
but i don't understand how i can compare the guesses and game generated by the computer in a way that i can say number one is correct but in the wrong position or number one is correct and so on for the other numbers. please help and sorry if i have bothered you