31 lines
675 B
JavaScript
31 lines
675 B
JavaScript
let batorzsido = false;
|
|
|
|
let myPromise = new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
if(batorzsido){
|
|
resolve("Ez a zsidó templomban is fingik");
|
|
}
|
|
reject("Ez a zsidó nem fingik a templomban");
|
|
}, 2000);
|
|
})
|
|
|
|
//setTimeout(asd, 3000);
|
|
|
|
function asd(){
|
|
myPromise.then(result => {console.log(result);}).catch(error => {console.log(error);});
|
|
}
|
|
|
|
asd();
|
|
|
|
|
|
let newpromise = new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
if (true){
|
|
resolve("OK");
|
|
}
|
|
reject("NOT OK");
|
|
}, 2000);
|
|
});
|
|
|
|
|
|
newpromise.then(result => {console.log(result);}).catch(error => {console.log(error);}); |