Alternative variant how to build game


#1

This is my version to build this game play

var myArray = ['Rock','Scissors','Paper'];
var rand = myArray[Math.floor(Math.random() * myArray.length)];
var runGame = function(choice) {
if (choice === rand){
console.log('draw')
}
else if ((choice === 'Scissors' && rand === 'Paper') || (choice === 'Rock' && rand === 'Scissors') || (choice === 'Paper' && rand === 'Rock')){
console.log('you win')
}
else {
console.log('you lose')
}

}
runGame('Rock')


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.