Who Wins?
Compare choices.
Time to Find the Winner! 🏆
You and the computer both made a pick. Now the big question: who wins? 🤔
We'll teach the code to compare the two picks! ⚖️
let you = 'rock'
let computer = 'scissors'
console.log('You: ' + you + ' ✊')
console.log('Computer: ' + computer + ' ✂️')Check for a Tie First 🤝
The easiest check is a tie. If both picks are the same, nobody wins!
We use === to see if they match. 🟰
let you = 'paper'
let computer = 'paper'
if (you === computer) {
console.log('It is a tie! 🤝')
}All lessons in this course
- The Rules
- Computer Picks
- Who Wins?
- Play Again