(
function
()
{})
===
(
function
()
{})
//=> false
Like arrays, every time you evaluate an expression to produce a function, you get a new function that is not identical to any other function, even if you use the same expression to generate it. “Function” is a reference type.
从上面的理论我们可以得到下面的有趣的结果
function test(){
console.log('test');
}
var copy = test;
test();// output : test
copy(); // output : test
test = function(){
console.log('another test');
}
test();// output : another test
copy(); // output : test