/***** 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}`)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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`)