Re:A summary of ECMAScript 6 features
by rzimmerman on Sunday February 15, 2015 @05:35AM
(#9052282)
I think:
beats the hell out of:
especially when you have conditionals or loops that can look like:
I suppose it doesn't get rid of callbacks, just makes them readable.
[ Parent
| on HN ]
> I suppose it doesn't get rid of callbacks, just makes them readable.
You are the one who stated generators were no solution to callback hell but async/await was, yet here's what your code looks like with generators:
app.get('/thing', function* (req, res) {
try {
let user = yield* db.get({user: req.user});
res.send({user: user});
} catch {
res.send(400);
}
});
...