每日一题 0630

75 阅读1分钟

有关函数定义

var y = 1;
if (function f() {} ) {
    y += typeof f;
}
console.log(y);

why

function f() {}实际定义了一个函数,typeof之后为function

typeof f不存在所以undefined