class Demo{
varA;
method=function(){
alert(this.varA)
}
}
this.varA not working above, varA is not accessible.
class Demo{
varA;
method= ()=>{
alert(this.varA)
}
}
But, this worked. I wonder why?what's the difference between function(){} and ()=>{} in typescript.