Jika lagi jangka pendek
name = ((city.getName() == null) ? "N/A" : city.getName());
Clear Constrictor
name = ((city.getName() == null) ? "N/A" : city.getName());
//Long version
let points = 70;
let result;
if(marks >= 50){
result = 'Pass';
}else{
result = 'Fail';
}
//Shorthand
let points = 70;
let result = marks >= 50 ? 'Pass' : 'Fail';
name = ((city == null) || (city.getName() == null) ? "N/A" : city.getName());