How do I write an arrow function in ES6 recursively?

后端 未结 12 818
南旧
南旧 2020-12-08 06:36

Arrow functions in ES6 do not have an arguments property and therefore arguments.callee will not work and would anyway not work in strict mode even

12条回答
  •  时光说笑
    2020-12-08 07:00

    Since arguments.callee is a bad option due to deprecation/doesnt work in strict mode, and doing something like var func = () => {} is also bad, this a hack like described in this answer is probably your only option:

    javascript: recursive anonymous function?

提交回复
热议问题