Need Help in ES6

Need Help in ES6
0

#1

I am building my electronic calculator.

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.


#2

You need to bind.

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

#3

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