0

I'm working on an Angular/Typescript codebase, and the previous author of the codebase has defined all of his TS methods in a particular way, using lambda functions. Personally I define my functions in the usual way, so I'm just wondering whether there is any difference/benefit to doing it his way rather than mine.

For example

functionXMyWay(param: string) {

}

functionXHisWay = (param: string) => {

}
Jake12342134
  • 1,539
  • 1
  • 18
  • 45
  • 2
    There's no such thing as a "lambda function" in Javascript. `=>` is called an "arrow function". – CertainPerformance Mar 31 '20 at 11:27
  • the difference is that the 2nd way is an arrow function which can't access `this`. When the 1st way is a normal function and has access to `this`. – satanTime Mar 31 '20 at 11:29

0 Answers0