var demo = { counter : 5 ,getCounter: () => this.counter};
console.log(demo.getCounter())
will print undefined;
how Can it print 5 without modifying the code(means by using arrow function only)
I tried apply,bind function But Nothing works
var demo = { counter : 5 ,getCounter: () => this.counter};
console.log(demo.getCounter())
will print undefined;
how Can it print 5 without modifying the code(means by using arrow function only)
I tried apply,bind function But Nothing works