Need Help in ES6

I am building my electronic calculator.


I decided to use oops in building this calculator.

I call the initHandler method to update the state of my calculator object.

But when I call some other method, it seems that state is lost.

Strangely the field values of the object are getting reset between method calls.

Is this a problem with ES6 or am I missing something, please help.

You need to bind.

this.handlers = {
  INIT : this.initHandler.bind(this),
1 Like

Thank you. That is just what I was looking for.