Hello,
I have a problem with javascript and I would like to understand why and how it works.
I have an object that uses an API. In this object I have an attribute of a list type of an object.
My objects are well informed with the data.
But when after I try to access my object list, I can’t.
If I do
console.log (myObjet.lstOtherObject);
My object list is displayed.
If I do
console.log (myObjet.lstOtherObject[0]);
It shows me undefined.
If I put my code in a setTimeout I have no problem.
When I set my list
addLight(light: Light) : boolean{
if(this._lstLights.find(e => e.uniqueid === light.uniqueid)){
return false;
}else{
this._lstLights.push(light);
return true;
}
}
What can be the problem ?
Thanx for your response