home work Rock, Paper, Scissors#8
Conversation
|
@azizomarck Please leave some feedback for Umit! |
| console.log("-------------------\nYou WIN! Congratulations\n-------------------"); | ||
| } else if(playerWin < computerWin){ | ||
| console.log("-------------------\nI am so sorry! Computer WIN!\n-------------------"); | ||
| } else { |
There was a problem hiding this comment.
I like that you are handling this case
| const computerSelection = computerPlay().toUpperCase(); | ||
| if(playerSelection === "ROCK" || playerSelection === "PAPER" || playerSelection === "SCISSORS"){ | ||
| let result = playRound(playerSelection,computerSelection); | ||
| if(result.includes("WIN")){ |
There was a problem hiding this comment.
others might disagree, but I would say it is not a reliable and the most efficient method to check for the winner.
| } else { | ||
| return `${computer === "PAPER" ? | ||
| `You WIN! \nYour Selection:${player} beats Computer Selection:${computer}` : | ||
| `You Lose! \nComputer Selection:${computer} beats Your Selection:${player}`}`; |
There was a problem hiding this comment.
It's cool that you used the ternary operator as the return value of your function, but I would suggest sticking with select statements only, esp because you have a long string in your ternary operator statements which hinder the readability of your code.
| // console.log('Hello, world!'); | ||
|
|
||
| function computerPlay(){ | ||
| const selections = ['rock', 'paper', 'scissors']; |
There was a problem hiding this comment.
I like that you have selection as a local variable, I should have done that too
| } | ||
| } | ||
|
|
||
| game(); |
There was a problem hiding this comment.
Thank you all suggest. I will consider next time.
No description provided.