"Why I Don't Buy the Dark Forest Hypothesis" [video]
youtube.com1 pointsby easybake0 comments
const handlePromise = function(resolve, reject) {
let x = 20;
let y = 20;
// return "Promises will not 'return' a value, they must be resolved or rejected";
if (x == y)
resolve(true);
// reject(false)
reject(new Error("x != y"))
}
const handleSuccess = function(value) {
console.log(value);
}
const handleCatch = function(err) {
console.log(err);
}
const example = new Promise(handlePromise);
example
.then(handleSuccess)
.catch(handleCatch);
> I feel so dumb for asynchronous javascript.