I was trying to learn how to avoid the anti pattern as described here What is the explicit promise construction antipattern and how do I avoid it?
I started with some code on JSFiddle but it does not output what I expected..
function sum1(x){
return new Promise(resolve => x+1)
}
function sum2(x){
return sum1(x)
.then(x => x+1);
}
function sum3(x){
return sum2(x)
.then(x => x+1)
}
sum3(1)
.then(console.log);
I would expect it to print 4
but it prints nothing