scrimba
Frontend Career Path
Essential JavaScript concepts
JS Mini Projects
Ternary Operator Challenge
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Ternary Operator Challenge
AboutCommentsNotes
Ternary Operator Challenge
Expand for more info
index.js
run
preview
console
const playerGuess = 3
const correctAnswer = 6

/*
Challenge
1. Refactor the if else statement to use a ternary operator.
*/

let message = ''
if (playerGuess === correctAnswer) {
message = 'Correct!'
}
else {
message = 'Wrong!'
}

console.log(message)
Console
"Wrong!"
,
/index.html
-3:47