My function return before executing the previous linse.
aliplutus
Posted on March 8, 2021
The following function return x before assigning it to res, despite I assign it in an earlier line then the return.
function newData() {
var x: [] | any = [];
lookup("GET", "api/post/", (res: myArrays["posts"], status: number) => {
x = res;
});
console.log(x);
return x;
}
💖 💪 🙅 🚩
aliplutus
Posted on March 8, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.