Iam pretty new to JS and I have a problem with extracting data from an async/await function. The following does work and it prints the correct answer which is a number to the console.
fetchData = userData.getPom().then(res => { console.log(res) })
But when I try to extract the res outside of the scope of the function it doesnt work, it still prints points as 0.
var points = 0
fetchData = userData.getPom().then(res => { points += res })
console.log(points)
What am I doing wrong? Thanks in advance
printscreen of both console.logs: