Basic usage of arguments.callee()

arguments.callee() is a pointer that points to the currently executing function and can be used inside the function.

The usage instructions are as follows:

  1. Using arguments.callee() in a regular function:
function foo() {
  console.log(arguments.callee); // 输出当前函数
}

foo();
  1. Using arguments.callee() in an anonymous function:
var foo = function() {
  console.log(arguments.callee); // 输出当前函数
};

foo();

Note: In strict mode, using arguments.callee will throw a TypeError error, so it is not recommended to use arguments.callee in strict mode.

bannerAds