Skip to content

Instantly share code, notes, and snippets.

p = new Promise((res, rej) => {
setTimeout(() => res("Success!"), Math.random() * 100 + 500);
setTimeout(() => rej((() => new Error("Failure!"))()), Math.random() * 100 + 500);
}).then((res) => console.log(res))
.catch((err) => console.log(err))
.then((res) => console.log("Finally!"));
There are two kinds of pianists.
There are some pianists who play, not because they enjoy it, but because their parents
force them to take lessons. Then there are those who play the piano because it
pleases them to create music. They don’t need to be forced; on the contrary, they
sometimes don’t know when to stop.
Of the latter kind, there are some who play the piano as a hobby. Then there are
those who play for a living. That requires a higher level of dedication, skill, and talent.
They may have some degree of freedom about what genre of music they play and the
stylistic choices they make in playing it, but fundamentally those choices are driven by
the needs of the employer or the tastes of the audience.