let user;
getCustomer(1)
.then(user => {
user = user;
return getTopMovies();
})
.then(movies => {
//i'll need this variable here but the value is undefined.
console.log(user);
})
Why i cant get the correct user
variable value? even though it should be available cause i defined it as global-scoped variable.