var isH = true;
var willNewPhone = new Promise(
function(resolve,reject){
if(isH){
var phone = {
brand:'xiaomi',
color:'red'
}
resolve(phone);
}else{
// var reason = new Error('she is no happy');
reject(4);
}
}
)
var askM = function(){
willNewPhone.then((data)=>{
console.log(data);
},(err)=>{
console.log(err,'----reject');
}).catch((err)=>{
console.log(err,'------catch');
})
}
askM();
var p1 = new Promise(
function(rs,rj){
rs('cg----')
})
p1.catch(res=>{
console.log('--aaaa--',res
)
})
var b = function(){
p1.then((data)=>{
console.log(data,'@@@@');
},(err)=>{
console.log('err11',err)
})
}
b();
console