I know there's 3 ways to make a local variable value accessible outside a function, such as explained by paul-stephenson here https://stackoverflow.com/a/407076/7738415.
I may have misunderstood something because it does not work in my following code:
var datas = {
list:[]
};
initTreeCustomer = () => {
customerService.loadAll().then(response => {
datas.list = response;
console.log(datas.list);
}).catch(err => {});
}
console.log(datas.list);
As you can guess, one console.log is fine, but not the second one.