JSFiddle - React, Tailwind, and code Playground
by Gerald Gillespie
JavaScript
const p1 = {};
const p2 = {}
p1.p = new Promise( (resolve)=>{
p1.resolve = resolve;
});
p2.p = new Promise( (resolve)=>{
p2.resolve = resolve;
});
const p1Then = p1.p.then( x =>{
console.log('p1 then',x);
return x;
})
p1.p.then( x=>{
console.log('p1 then\'',x);
}).then( x=>{
console.log('p1 then\' then',x)
})
p1.resolve('go!');
p1Then.then( y=>{
console.log('p1 then then', y);
});
console.log('last');
Promise.resolve('immediately resolved').then(x=>console.log(x));