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