Skip to content

Instantly share code, notes, and snippets.

@jikeytang
Created July 22, 2014 00:14
Show Gist options
  • Save jikeytang/c95f42b08143a7972253 to your computer and use it in GitHub Desktop.
Save jikeytang/c95f42b08143a7972253 to your computer and use it in GitHub Desktop.
[ Javascript ] - 20140722-题目1
// 感谢深圳[时空]贡献 腾讯面试题一枚
f = function() {return true;};
g = function() {return false;};
(function() {
if (g() && [] == ![]) {
f = function f() {return false;};
function g() {return true;}
}
})();
console.log(f());
// true or false ? 为什么?
ps:
考察点:
作用域链(scope chain)、执行环境(execution context)、变量对象(variable object)命名函数表达式 等。
@jikeytang
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment