05. Thenable
// Resolving a thenable object
const p1 = Promise.resolve({
then(onFulfill, onReject) {
onFulfill("fulfilled!");
}
});
console.log(p1 instanceof Promise); // true, object casted to a Promise
p1.then(
value => {
console.log(value); // "fulfilled!"
},
e => {
// not called
}
);Last updated