Depending on your preferred code style, you may want to get rid of != null
when a boolean coercion would work.
Warning
Regardless, keep in mind that if the value might be false, '', 0, or NaN, then a boolean coercion may not work as expected.
if (currentUser() != null) {
let left;
sendMessage((left = customMessage()) != null ? left : 'Hello');
}
if (currentUser()) {
sendMessage(customMessage() || 'Hello');
}