After watching fun fun function, I decided not to use the new keyword.
But here is a foundational example of how to use promises:
var promise = new Promise(function(resolve, reject) {
// do a thing, possibly async, then…
if (/* everything turned out fine */) {
resolve("Stuff worked!");
}
else {
reject(Error("It broke"));
}
});
Q: How do I create a promise without the use of the new keyword?