Skip to content

Instantly share code, notes, and snippets.

@jikeytang
Created August 19, 2014 01:38
Show Gist options
  • Save jikeytang/f86526f2a9812c696a74 to your computer and use it in GitHub Desktop.
Save jikeytang/f86526f2a9812c696a74 to your computer and use it in GitHub Desktop.
[ Javascript ] - 20140819-题目1
1.
(function f(f){
return typeof f();
})(function(){ return 1; });
求出以上表达式的值,为什么?
PS:
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。
```javascript
// you code
```
2. 粘贴代码时请使用shift+tab,缩进前面的空白。
@qifeng0748
Copy link

number
下面变形下:

// 参数放到f()处。
(function f(){
    return typeof (function(){ return 1; })();
})();
// 执行后返回1
(function f(){
    return typeof 1;
})();

@iLoosen
Copy link

iLoosen commented Sep 1, 2014

number

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