<script>var flag = true;var promiseObj = new Promise(function (resolve, reject) {if (flag) {resolve({name: 'zs'});} else {reject({msg: '失败了'})}})//获取promiseObj对象的数据,then获取成功的信息,catch获取失败的信息promiseObj.then(function (res) {console.log(res);}).catch(function (error) {console.log(error);})</script>
