Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, an object with a then() method is a promise.

Promise.resolve({then: () => console.log('called')})

Promises autoflatten since you can't have Promise<Promise<T>>, so you'll see that this code prints 'called'.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: