Why is arguments.callee.caller.name undefined?

后端 未结 4 1434
猫巷女王i
猫巷女王i 2021-01-25 04:59

How come this doesn\'t alert \"http://127.0.0.1/sendRequest\"? (Available at http://jsfiddle.net/Gq8Wd/52/)

var foo = {
    sendRequest: function() {
        ale         


        
4条回答
  •  别那么骄傲
    2021-01-25 05:45

    Although the function is stored under the object property foo.sendRequest, and thus can be invoked via foo.sendRequest(), that function itself doesn't actually have a name. That's why arguments.callee.caller.name is empty.

提交回复
热议问题