请有人解释一下这里到底发生了什么。
var y = 1;
if (function f(){return 'some text';}) {
y += typeof f;
}
console.log(y);// "1undefined"
如果我将它改为函数表达式
var y = 1;
if (a = function f(){return 'some text';}) {
y += typeof a;
}
console.log(y);// "1function"
typeof f
的输出时,我不得不再看一遍,直到我记起它实际上不是函数声明。 - Patrick Roberts