← 返回试题目录ECMA练习题
共 13 道。点击题干免费试做,答案在提交后查看。
难度 2<p><strong>以下代码输出什么</strong></p> <pre> <code>const shape = { radius: 10, diameter() { return this.radius * 2 }, perimeter: () => 2 * Math.PI * this.radius, } shape.diameter() shape…
难度 3<p><strong>以下代码输出什么</strong></p> <pre> <code>var x = 1 function foo(x, y = () => (x = 5)) { x = 9 y() console.log(x) } foo()</code></pre> <hr />
难度 2<p>请问以下代码的输出结果是</p> <pre> !function e(){ console.log("!"+e+"()"); }()</pre>
难度 3<pre> <code>以下程序输出的是: function Foo(){ getName = function() { alert(1) }; return this }; Foo.getName = function () { alert(2) }; Foo.prototype.getName = function () { alert(3) }; va…
难度 2<pre> 以下代码将会输出: function fn() { var a = 10; console.log(b) var b = 20 } fn()</pre>
难度 3<pre> <code>var a = 10; var obj1 = { a: 20, fn: (function() { this.a *= 2; a = 5; var a = 6; return function() { this.a *= a; console.log(a) } })() } var obj2 = { a: 30 } var fn = …
难度 2<pre> <code>if(!("a" in window)){ var a = 10; } console.log(a); </code></pre>
难度 3<pre> <code>以下调用的输出是: function Person(){ getAge = function(){ console.log(10); } return this; } Person.getAge = function(){ console.log(20); } Person.prototype.getAge = function(){…
难度 2<pre> <code>for(var i=0; i<10; i++){ setTimeout(function() { console.log(i); },0) }</code></pre> <p>请问输出什么?<br /> 如果要输出'0123456789',要怎么改?</p>
难度 2<pre> <code><em>以下程序将会输出__() var arr=[1,2,3,4,5];</em> <strong>for</strong>(<strong>var</strong> i=0;i<arr.length;i++) { arr[i]=<strong>function</strong>(…
难度 2<pre> <code>以下程序将会输出 __()和__() <strong>var</strong> baz=3; <strong>var</strong> bazz={ baz: 2, getbaz: <strong>function</strong>( ) { …
难度 1<pre> <code>以下代码将会输出 1 2 <strong>var</strong> a=4; 3 <strong>function</strong> <strong>b</strong>() { 4 a=3; 5 console.log(a); 6 <strong>fun…
难度 2<p><strong>alert(1&&2),alert(1||0) 的输出结果将是</strong></p>