Strict mode alternatives to this instanceof arguments.callee

前端 未结 1 1541
后悔当初
后悔当初 2021-02-19 15:52

There\'s an old trick (that I learned on SO) to catch calling a constructor as a function, i.e. forgetting the new keyword. The following, or something like, it goe

相关标签:
1条回答
  • 2021-02-19 16:02

    arguments.callee itself is deprecated in favor of named function expressions. Although I don't necessarily agree with this move, it is how things have progressed. As such, replacing arguments.callee with the function name is the only way in strict mode, and is also the preferred way in non-strict mode.

    0 讨论(0)
提交回复
热议问题