← 返回试题目录

ECMA练习题

共 13 道,当前难度 8 道。点击题干免费试做,答案在提交后查看。

难度 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…

难度 2

<p>请问以下代码的输出结果是</p> <pre> !function e(){ console.log(&quot;!&quot;+e+&quot;()&quot;); }()</pre>

难度 2

<pre> 以下代码将会输出: function fn() { var a = 10; console.log(b) var b = 20 } fn()</pre>

难度 2

<pre> <code>if(!(&quot;a&quot; in window)){ var a = 10; } console.log(a); </code></pre>

难度 2

<pre> <code>for(var i=0; i<10; i++){ setTimeout(function() { console.log(i); },0) }</code></pre> <p>请问输出什么?<br /> 如果要输出&#39;0123456789&#39;,要怎么改?</p>

难度 2

<pre> <code><em>以下程序将会输出__() var arr=[1,2,3,4,5];</em> &nbsp;<strong>for</strong>(<strong>var</strong> i=0;i<arr.length;i++) &nbsp;{ &nbsp; &nbsp; arr[i]=<strong>function</strong>(…

难度 2

<pre> <code>以下程序将会输出 __()和__() &nbsp;<strong>var</strong> baz=3; &nbsp;<strong>var</strong> bazz={ &nbsp; &nbsp; baz: 2, &nbsp; getbaz: <strong>function</strong>( ) { &nbsp; &nbsp;…

难度 2

<p><strong>alert(1&amp;&amp;2),alert(1||0) 的输出结果将是</strong></p>

ECMA练习题 - 生命科学与前沿科技学习平台 | 必学必会