How can I access the value of function result into a variable, actually I am trying to get the value from this function and save it into a variable so then I can submit this value into POST request, but right now I am unable to get the value, what I did in this function I have puppeteer node js code I have a result of OCR into a variable and I just need to submit this OCR result into POST login function.
let res = "";
// Run and wait the result
ocrSpaceApi.parseImageFromLocalFile(imageFilePath, options)
.then(function (parsedResult) {
//console.log('parsedText: n', parsedResult.parsedText);
res = parsedResult.parsedText;
console.log(res);
}).catch(function (err) {
console.log('ERROR:', err);
});
console.log(res);
want the parsed result in RES varaiable.