I have an es6 class the instantiate a variable from a function call, but the problem is it seems that the function is running before the constructor instantiated and throw an error:
constructor() {
this.userSelections = {
types : this.getTypes(),
providers: this.getProvider()
}
}
getProvider() {
// here its throw error that this.userSelections is undefined
var activeType = this.userSelections.types.some(( type ) => {
return type.active;
});
}
Whats is the problem and how i can handle this situation?