2 ms·
What dwrensha said, although I'd describe it like this: Allowing then() to take a function which returns a bare value rather than a promise is just syntax suga
by kentonv 13y ago
What dwrensha said, although I'd describe it like this: Allowing then() to take a function which returns a bare value rather than a promise is just syntax sugar. You can always wrap a bare value in a promise by creating an immediate (already-fulfilled) promise. Giving then() such a function -- that wraps its result in a promise -- is equivalent in behavior to giving then() a function that just returns a bare value, except that the latter is somewhat more efficient in implementation.