For the following code, result.arr should be printed first then result.arr but its the opposite that is happening. How can i prevent this.
var ans = null;
async function getUserData() {
await chrome.storage.local.get(["arr"], function(result) {
console.log(result.arr);
ans = result.arr;
});
console.log("qr");
}
Yes i have gone through those StackOverflow legendary answers about callbacks.