← 返回试题目录

ECMA练习题

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

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

难度 3

<pre> <code>以下程序输出的是: function Foo(){ getName = function() { alert(1) }; return this }; Foo.getName = function () { alert(2) }; Foo.prototype.getName = function () { alert(3) }; va…

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

难度 3

<pre> <code>以下调用的输出是: function Person(){ getAge = function(){ console.log(10); } return this; } Person.getAge = function(){ console.log(20); } Person.prototype.getAge = function(){…

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