Turns out i was declaring functions for classes differently in JS

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?

139 thoughts on “Turns out i was declaring functions for classes differently in JS”

  1. Pingback: the keto diet
  2. It is appropriate time to make some plans for the long run and it’s time
    to be happy. I’ve learn this put up and if I may I desire to
    suggest you few fascinating issues or advice.
    Perhaps you can write next articles referring to this
    article. I wish to read more issues about it!

    Reply
  3. Pretty great post. I just stumbled upon your weblog and wanted to say that I’ve really enjoyed surfing around your blog posts.
    In any case I will be subscribing in your feed and I’m hoping you write once more very soon!

    Reply
  4. Hello there, I found your website by the use of Google at the same
    time as looking for a similar subject, your site came up, it appears to be like good.

    I have bookmarked it in my google bookmarks.

    Hi there, just was alert to your blog via Google, and found that it is really
    informative. I am going to be careful for brussels.
    I will appreciate when you proceed this in future. Many
    other folks might be benefited out of your writing. Cheers!

    Reply
  5. Do you have a spam issue on this site; I also am a blogger, and I was
    curious about your situation; we have created some nice procedures and we are looking to exchange methods with other
    folks, be sure to shoot me an e-mail if interested.

    Reply