function Circle(radius){
this.radius = radius;
this.draw = ()=>{
console.log(`draw`);
}
};
const p = new Circle(12);
p.__proto__.showRadAnony = ()=>{
return this.radius;
}
p.__proto__.showRadNorm = function(){
return this.radius;
}
console.log(p.showRadNorm());
console.log(p.showRadAnony());
I add showRadAnony
method to Circle.prototype
by initiate it with anonymous function while add showRadNorm
too which does same thing with showRadAnony
but initiated it by arrow function.
When I run the code, showRadNorm
shows 12 in console. while showRadNorm
returns undefined
Is it because arrow function is new feature of es6?