I use the oberserver pattern to listen for a variable. At first the incoming object is undefined. If this is the case, further functions should not be executed. Only if the object is not undefined, the functions should be executed. I have tried many things like if(a !== undefined), if(typeof a != 'undefined'), ... I always get the same error in the line a.prop.find() or in the if statement itself. 
Cannot read property 'a' of undefined
How can I check correctly?
A.class
const a = state.find(state => state.id === this.id);
return a;
B.class
this.val.subscribe((a) => {
  // Check if a is undefined
  a.prop.find(...);
}
 
    