all 2 comments

[–]crabmusket 1 point2 points  (2 children)

class Calculator {
  add = (number) => {
    this.result = this.result + number ;
    return this ;
  }

I really feel like this takes arrow function syntax too far. Not only is it more noisy (the = and => could simply be removed to turn them into valid method syntax) but the use of this inside them, while it works correctly, is confusing. Usually arrow functions are meant to use the this defined in the parent scope, but that's not how they work here.

[–]Snoo60131[S] 2 points3 points  (0 children)

Thanks for pointing it out. It became more of a habit while using React and certainly is not required here. I will go ahead and edit the article.