I am facing some issue or may it something new comes with fat-arrow function while implementing prototype.
Here is the problem::
function baseClass() {
this.name = "Pankaj";
}
baseClass.prototype.fnGetName = function() {
return this.name;
};
baseClass.prototype.fatArrayGetName = () => {
return this.name;
};
var classObject = new baseClass();
Now when I try to retrieve name property of class using methods as:
classObject.name; // returns Pankaj
classObject.fnGetName() // returns Pankaj
classObject.fatArrayGetName() // returns "" (EMPTY STRING)
Just want to know why fatArrayGetName function return empty string where as it should return name property value.