Javascript functions - Sometimes they have names, sometimes they don't.

Some of the key call-outs from the code below:

  • JavaScript Class methods added after the fact with fat arrow functions don't get the function.name property 😣
  • Methods added at class definition time using the shorthand syntax are special and are given the name prop 😃
  • We can hack-in the name property to our methods if we define the name property as writable.
  • An unnamed anonymous function has no name either, as expected.
  • If we go back to the old school named function style, our class method will have a name!

Corey Snyder

Corey Snyder

Senior Front-End Engineer for Aver Inc.. I have independently developed & released multiple video-games. I play Ice Hockey, I race FPV Drones, and I love my Subaru WRX STI.

Read More