i tried to store data in a variable and return the result from function but I'm not getting data from function if I console.log inside callback function I'm getting data but not outside
here is the code
const ReadingTtlFile = () => {
let quadData = [];
let prefixData = [];
parser.parse(currentQueryData, (error, quad, prefixes) => {
let result = [];
if (quad) {
result.push(quad);
} else {
// console.log("# That's all, folks!", prefixes);
prefixData.push(prefixes);
}
quadData.push(result);
});
return [...quadData];
};
let ttlData = ReadingTtlFile();
console.log(ttlData)
//here I'm getting undefined