Are there downsides to these JavaScript class definitions?

I have been defining methods like this:

Class Man {
  constructor(name) {
    this.name = name;
    this.draw = (context) => {drawMan(context,this.name)};
  }
}

I have become aware there is another method of defining methods, which looks like this:

Class Man {
  constructor(name) {
    this.name = name;
  }
  draw(context) { drawMan(context, this.name) };
}

Are there significant downsides to my approach?

10 thoughts on “Are there downsides to these JavaScript class definitions?”

  1. Fantastic items from you, man. I have have in mind your stuff previous to
    and you’re just too fantastic. I really like what you have got here, really
    like what you are saying and the way through which you are saying it.

    You make it entertaining and you continue to care for
    to stay it sensible. I can’t wait to learn far more from you.
    This is actually a great site.

    Reply
  2. With havin so much content do you ever run into any problems
    of plagorism or copyright violation? My site has a lot of
    exclusive content I’ve either written myself or outsourced but it looks like a lot
    of it is popping it up all over the web without
    my authorization. Do you know any methods to help stop content from being stolen? I’d
    really appreciate it.

    Reply
  3. Интернет-платформа Joy casino появилась на российском рынке в две тысячи четырнадцатом году.
    Пользователям веб-сервиса предложен сертифицированный софт от проверенных временем провайдеров.
    В ассортимент цифровых развлечений вошли автоматы барабанного типа, лайв-игры и ставки на спортивные
    события.

    Reply

Leave a Comment