我需要定义名称函数以与更远的另一种方法一起使用,因此我需要对其进行动态命名。
目前...
`use strict`;
const factory = () => () => {}
const method = factory();
method.name === undefined
&&
const factory = () => { const name = () => {}; return name }
const method = factory();
method.name === "name"
因为...
`use strict`;
const factory = () => () => {}
factory() === () => {} // and () => {} is not a named method
但我想要...
`use strict`;
const factory = () => () => {}
const method = factory();
method.name === "method"
这是额外的描述,因为堆栈溢出要我说更多,但我认为问题是不言自明的