In this situation, arguments.callee.name get nothing.
foo = function(){
  console.log(arguments.callee.name);
}
Is there any solution?
In this situation, arguments.callee.name get nothing.
foo = function(){
  console.log(arguments.callee.name);
}
Is there any solution?
 
    
    You didn't name it, thus it has no name.
foo = function(){
  return (arguments.callee.name);
};
bar = function foobar() {
  return (arguments.callee.name);
};
function foobar () {
  return (arguments.callee.name);
}
console.log(foo()); //""
console.log(bar()); //"foobar"
console.log(foobar()) //"foobar"
The difference between foo() and foobar() is that foo() is a function expression, whereas foobar() is a declared function. The difference between foo() and bar() and is that one has a name, the other doesn't. Both are function expressions. Declared functions need a name, function expressions do not. See this canonical question for more info:
var functionName = function() {} vs function functionName() {}