That function is thenable so following it .then is called and the result or error is passed to the first or second function respectively.