function checkAnswerMatch(currentGuess, answer){
// This method will compare two sequences of input parameters:
// "currentGuess", the sequence of guesses, and "answer", which
// is the correct solution sequence generated by the method you wrote
// above (generateSolution).
// This method should return the number of correct matches between the
// two inputs, where a correct match is defined as the same character in
// the same position in each of the two input strings.
//WRITE YOUR CODE HERE
var correctMatches = 0;
for( var i=0; i < 4; i++ ){
if(currentGuess[i]===answer[i]){
correctMatches++;
}
}
return correctMatches;
}
No comments:
Post a Comment