4 ms·
The advantage of promises is that you can return them as a type, you can't do that with a callback. If you fetch something from a database , your data access ob
by spriggan3 10y ago
The advantage of promises is that you can return them as a type, you can't do that with a callback. If you fetch something from a database , your data access object can return a promise and let the client code deal with the result. Promises are composable by nature, callbacks are not.