My createCon function uses this to set the con for this object. I am getting this to be undefined. Error: Can not set property of 'con' of undefined. What is the best of being able to reference this from the objects functions?
class parent {
constructor(stringA, stringB){
this.config = {};
this.con = {};
}
}
class child extends parent {
constructor(stringA, stringB) {
super(stringA,stringB)
this.config = {
full : stringA+stringB
}
}
createConn(){
var con = con(this.config.full);
con.connect(function(err){
if(!err) this.con = con;
})
}
}