JavaScript
Ternary operator on log messages

by Benny Neugebauer

if (missingClients.length === 0) {
  this.logger.info(`Message was sent to all other "${selfClients.length}" clients.`);
} else {
  this.logger.info(`Message was NOT sent to the following own clients: ${missingClients.join(',')}`);
}

const logMessage = missingClients.length
  ? `Message was sent to all other "${selfClients.length}" clients.`
  : `Message was NOT sent to the following own clients: ${missingClients.join(',')}`;
this.logger.info(logMessage);