我现在是一个愚蠢的问题,但是,我可以给出当前函数的名称?我对这个很感兴趣,因为我通常使用控制台和我想要得到它jQuery +获取函数的名称
var debug = true;
var myFunction = $("div").on("click", function(e) {
//
var error = "";
var something = true;
//
if(something == true) error = "Something has happened";
if(debug)
console.log("Ups!" + myFunction.name + " >> "+ error);
//
});
在此先感谢
这并不在我的jQuery例如工作
Can I get the name of the currently running function in JavaScript?
http://stackoverflow.com/questions/1013239/can-i-get-the-name-of-the-currently-running-function-in-javascript –