scrimba
Frontend Career Path
Essential JavaScript concepts
JS Mini Projects
Short-circuiting with OR (||)
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

Short-circuiting with OR (||)
AboutCommentsNotes
Short-circuiting with OR (||)
Expand for more info
index.js
run
preview
console
const jobHunter = {
name: 'Tom Chant',
jobSearchArea: 'Europe',
}

/***** if else *****/
if (jobHunter.jobSearchArea) {
console.log(`${jobHunter.name}'s work location is ${jobHunter.jobSearchArea}`)
}
else {
console.log(`${jobHunter.name}'s work location is Worldwide`)
}

/***** ternary *****/
// const workLocation = jobHunter.jobSearchArea ? jobHunter.jobSearchArea : 'Worldwide'
// console.log(`${jobHunter.name}'s work location is ${workLocation}`)




Console
"Tom Chant's work location is Worldwide"
,
/index.html
-5:02