scrimba
Create an RPG game - Rob Sutcliffe
Ternary Operators
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 Operators
by
AboutCommentsNotes
Ternary Operators
by
Expand for more info
index.js
run
preview
console
import { emails } from "./data";

// add a condition to check for any emails that are read
// then add a class to our email div (currently with class email)
// so it has an extra class of 'read'
const getEmailHtmlString = (emailsArray) =>
emailsArray.map(({ sender, subject, date, read }) =>
`<div class="email">
<span>${sender}</span>
<span>${subject}</span>
<span>${date}</span>
</div>`
);

const emailsHtmlString = getEmailHtmlString(emails);

document.getElementById("emails").innerHTML = emailsHtmlString.join("");
Console
/index.html
-5:04