如何比较javascript中的2个函数?我不是在谈论内部参考.说
var a = function(){return 1;};
var b = function(){return 1;};
Run Code Online (Sandbox Code Playgroud)
有可能比较a和b?
难道不知道两个函数是否相同吗?例如,编译器编写者想要确定开发人员编写的两个函数是否执行相同的操作,可以使用哪些方法来确定那个函数?或者我们可以做些什么来找出两个TM是相同的?有没有办法规范机器?
编辑:如果一般情况是不可判定的,在正确地说两个函数是等价的之前,您需要多少信息?
是否有可能在Javascript中检测重复的功能(在某些情况下可能会意外写入)?在Google Chrome中,
printLah(); //this prints "Haha" for some reason, without even printing an error message in the Javascript console!
function printLah(){
alert("Hahah!");
}
function printLah(){
alert("Haha");
}
Run Code Online (Sandbox Code Playgroud)