Comment

Comment by pmalynin

I recently started programming more using promises and I can say that I am very satisfied with the way it does away with the callback hell problem.

Instead of taking a callback, a function returns a promise, which can be daisy-chained to do work.

Ex:

file.read().then(console.log);

Or using the example in the article:

var a = fileA.read();

var b = fileB.read();

promise.all([a,b]).then((data) => console.log(data[0], data[1]));

parent pmalynin 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton