const user = {
profile: {
settings: {
theme: 'dark',
notifications: null
}
}
};
const getNotificationSound = (user) => {
return user?.profile?.settings?.notifications?.sound ?? 'default';
};
console.log(getNotificationSound(user));
console.log(getNotificationSound(null));
console.log(getNotificationSound({ profile: {} })); Post #2961
3.51K
CHALLENGE
- ❤ 6
- 👍 6
- 🔥 3