列表

详情


FED48. this指向

描述

请补全JavaScript函数,使obj对象中fn函数返回该对象中a属性和b属性的和。

原站题解

HTML/CSS/JavaScript 解法, 执行用时: 1680ms, 内存消耗: 77812KB, 提交时间: 2022-02-08

{"css":"","js":"var obj = {\n    a: 1,\n    b: 2,\n    fn: function(){\n        // 补全代码\n        return obj.a+obj.b\n    }\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1682ms, 内存消耗: 77772KB, 提交时间: 2022-02-09

{"css":"","js":"var obj = {\n    a: 1,\n    b: 2,\n    fn: function(){\n        // 补全代码\n        return Number(this.a)+Number(this.b);\n    }\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1729ms, 内存消耗: 77864KB, 提交时间: 2021-12-13

{"css":"","js":"var obj = {\n    a: 1,\n    b: 2,\n    fn: function(){\n        // 补全代码\n        return this.a+ this.b\n         \n        \n    }\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1735ms, 内存消耗: 77820KB, 提交时间: 2021-12-13

{"css":"","js":"var obj = {\n    a: 1,\n    b: 2,\n    fn: function(){\n        // 补全代码\n        return this.a + this.b \n    }\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1737ms, 内存消耗: 77884KB, 提交时间: 2022-02-19

{"css":"","js":"var obj = {\n    a: 1,\n    b: 2,\n    fn: function(){\n      return this.a+this.b\n        \n    }\n}","html":"","libs":[]}

上一题