I am at the end of my wits. Maybe somebody can shed some light. I am essentialy trying to run a function 10x using a for loop and then push the results into an array. However, all I get is ten "undefined" in my array. The actual resolved value from the function is not being pushed into array. Does anyone have an idea?
Here's the code
function playGame(){
var userChoice = getUserChoice('rock');
var computerChoice = getComputerChoice();
console.log(determineWinner(userChoice,computerChoice));
};
function keepScore () {
let resultArray = [];
for(let x = 0; x < 10; x++){
resultArray.push(playGame(x))
}
console.log(resultArray);
};
keepScore();
Thanks in advance
playGame()playGameneeds toreturn determineWinner(userChoice,computerChoice)instead of just logging it.