5

So after reading T.J. Crowder's answer to this question, it seems that the ES 6 spec has rules for inferring function names for anonymous functions bound to variable names. Do we still need to use named function expressions? It looks like ES6 makes it unnecessary.

Community
  • 1
  • 1
Mark Cuban
  • 307
  • 1
  • 2
  • 7

1 Answers1

1

Not yet. There is no fully ES 6 compliant JS environment yet. Plus we'll have to support legacy browsers for years to come. However since one of the main points of using named function expressions is that you get better stack traces on errors, when and if implementations catch up to the ES 6 spec then as long as your development environment is compliant you may be able to get by without them.

Jared Smith
  • 19,721
  • 5
  • 45
  • 83
  • question is not about if ES6 is widely supported – Peter Aron Zentai Jan 05 '16 at 12:04
  • @PeterAronZentai question is (AFAIK) whether ES 6's rules on inferring function names from variable names make using named function expressions unnecessary. 'Not yet' (I thought) pretty clearly indicates 'yes but not today'. The comment about ES 6 support explains *why* not today. I deemed it relevant. – Jared Smith Jan 05 '16 at 13:17