I am following the notes on ES6 from this link and created a small code snippets to play around.
class Bar{
constructor(x,y){
this.x = x;
this.y = y;
}
}
let bar = new Bar(12,10);
Bar.prototype.foo =function(){
return this.x + this.y;
}
bar.foo() // 22 correct
I am so happy until i do this.
let baz = bar.foo
baz(); // NaN
Why baz() is printing NaN ?