const isPregnant = false; const promise = new Promise((resolve,reject) =>{ if(isPregnant){ resolve('孩子他爹') }else { reject('老公'); } }); promise .then(name =>{ console.log('男人成为了' + name) }) .catch(name =>{ consle.log('男人成为了' + name) }) .finally(() =>{ console.log('男人和女人最终结婚了') })