A better async/reactive function design in JS (or any other languages) — the Universal Currying Callback (UCC) Design
For the principle "Don't call us, we'll call you", the modern function design uses callbacks, Promise, or monad/stream-based techniques (e.g. Rx) to let you subscribe the async results.
The following is a usual JS function implementation using the callback for async:
function register(username, password, email, callback) {
// processing async work