scrimba
Frontend Career Path
React basics
Meme generator
Challenge: ternary practice
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

Challenge: ternary practice
AboutCommentsNotes
Challenge: ternary practice
Expand for more info
App.js
run
preview
console
import React from "react"

export default function App() {
/**
* Challenge: Replace the if/else below with a ternary
* to determine the text that should display on the page
*/
const isGoingOut = true

let answer // Use ternary here
if(isGoingOut === true) {
answer = "Yes"
} else {
answer = "No"
}

return (
<div className="state">
<h1 className="state--title">Do I feel like going out tonight?</h1>
<div className="state--value">
<h1>{answer}</h1>
</div>
</div>
)
}
Console
/index.html
-3:50