here is a simple promise call
new Promise(function(success,){
setTimeout(function(){success()},1000);
}).then(function(){
console.log(1)
});
as you can see, the console can output 1
The then method ofPromise can do callback, but what if this is the case?
function test(back){
setInterval(function(){back()},1000)
}
test(function(){
console.log(1);
});
/ / you can keep outputting 1
.and if you can"t do it with promise:
new Promise(function(success,){
setInterval(function(){success()},1000);
}).then(function(){
console.log(1)
});
does Promise have hidden advanced features in addition to then,catch?