LLD - Behavioral Design Patterns — Part 2
Find the bug in this Null Object usage:
class NullNotifier {
notify(message) { console.log(message); }
}
function sendNotification(notifier, msg) {
if (notifier != null) {
notifier.notify(msg);
}
}
sendNotification(null, 'Hello');