以下代码的输出结果是
var f = function g() { return 23; }; typeof g();
// ff typeof g(); // ReferenceError: g is not defined typeof g; // "undefined" // chrome typeof g(); /* VM112:5 Uncaught ReferenceError: g is not defined at <anonymous>:5:8 at Object.InjectedScript._evaluateOn (<anonymous>:875:140) at Object.InjectedScript._evaluateAndWrap (<anonymous>:808:34) at Object.InjectedScript.evaluate (<anonymous>:664:21)(anonymous function) @ VM112:5InjectedScript._evaluateOn @ VM106:875InjectedScript._evaluateAndWrap @ VM106:808InjectedScript.evaluate @ VM106:664 */ typeof g; // "undefined" // IE9 typeof g(); // "number" typeof g; // "function"
/** * 以下是我的测试结果 */ // Editplus 3 :(编辑器的自带浏览器模式 Ctrl+B) typeof g() // number typeof g // function typeof f() // number typeof f // function // Chrome: typeof g() // 无输出响应 typeof g // undefined typeof f() // number typeof f // function // Firefox: typeof g() // 无输出响应 typeof g // undefined typeof f() // number typeof f // function // IE8: typeof g() // number typeof g // function typeof f() // number typeof f // function