最近在 perfectionkills 上看到几道 JavaScript 题目,这里拿来分享一下,下面列举出来了题目,你可以在这里做题,答案解析可以到这里找到。

1.
1 2 3
| (function(){ return typeof arguments; })();
|
2.
1 2
| var f = function g(){ return 23; }; typeof g();
|
3.
1 2 3 4
| (function(x){ delete x; return x; })(1);
|
4.
1 2
| var y = 1, x = y = typeof x; x;
|
5.
1 2 3
| (function f(f){ return typeof f(); })(function(){ return 1; });
|
6.
1 2 3 4 5 6 7
| var foo = { bar: function() { return this.baz; }, baz: 1 }; (function(){ return typeof arguments[0](); })(foo.bar);
|
7.
1 2 3 4 5
| var foo = { bar: function(){ return this.baz; }, baz: 1 } typeof (f = foo.bar)();
|
8.
1 2
| var f = (function f(){ return "1"; }, function g(){ return 2; })(); typeof f;
|
9.
1 2 3 4 5
| var x = 1; if (function f(){}) { x += typeof f; } x;
|
10.
1 2
| var x = [typeof x, typeof y][1]; typeof typeof x;
|
11.
1 2 3
| (function(foo){ return typeof foo.bar; })({ foo: { bar: 1 } });
|
12.
1 2 3 4 5
| (function f(){ function f(){ return 1; } return f(); function f(){ return 2; } })();
|
13.
1 2
| function f(){ return f; } new f() instanceof f;
|
14.
1 2
| with (function(x, undefined){}) length;
|
点击下面按钮提交您的答案
试试手气