79256869

Date: 2024-12-06 04:49:16
Score: 1
Natty:
Report link

In your case the main difference is how this keyword works with both functions. So here when you use Regular functions (function () {}) the this keyword refers to the object instance(in this case person1), so this.name returns name of object. whereas, when you used Arrow function (() => {}) the this keyword referred to where the function was defined (in this case, the global scope) instead of referring to an object, so this.name becomes undefined.

Reasons:
  • Whitelisted phrase (-1): In your case
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: throwaway232