I am trying to access a variable that i declared inside in an async function. Like this:
exports.startTheBasketEngine = async (username, password, domainData) => {
const parse = domainData.auctionUrl.split("-")
var domainName = parse[0]
const stringIsIncluded = await page.evaluate(() => {
console.log(domainName)
});
}
The console.log line is returning that error:
UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: domainName is not defined
How can i resolve this problem?
await page.evaluate((dName) => { console.log(dName); }, domainName);?