Why is resolve
not defined through closure inside of myFunction
in the code below?
const myFunction = () => {
resolve();
}
const p = new Promise((resolve) => {
myFunction();
}
(node:1232) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: resolve is not defined