小编hld*_*dev的帖子

How to change Javascript function name that appears in toString()?

Function.name property is configurable and can be overriden, but if I try

function foo() {}
Object.defineProperty(foo, 'name', {value: 'bar'})
Run Code Online (Sandbox Code Playgroud)

foo.toString() still shows up as "function foo() {}" but I expected it to be "function bar() {}".

javascript firefox google-chrome

2
推荐指数
1
解决办法
248
查看次数

标签 统计

firefox ×1

google-chrome ×1

javascript ×1