ThoseBecause those three inner functions (publish, subscribe and unsubscribe) are declared inside an outeranother function: they would not, by default, they wouldn't exist anywhere except locally inside theanywhere outside that outer anonymous function in which they were declared.
By returning that { ... } object with those three properties, you are effectively offering a 'public' API into the messageBus – messageBus will beequal an object with properties of those 3 functions that, so they can be called from the outer scope.
If the object wasn't returned, there would be no way to call those three inner functions from anywhere in the outer scope.