FED67. 模块
描述
完成函数 createModule,调用之后满足如下要求:HTML/CSS/JavaScript 解法, 执行用时: 863ms, 内存消耗: 77840KB, 提交时间: 2020-11-21
{"css":"","js":"function createModule(str1, str2) {\n var obj = {\n greeting : str1,\n name : str2,\n sayIt :function(){\n return this.greeting + ', ' + this.name\n }\n }\n \n return obj\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 863ms, 内存消耗: 77856KB, 提交时间: 2020-11-23
{"css":"","js":"function createModule(str1, str2) {\n var obj={\n sayIt(){\n return this.greeting+', '+this.name;\n }\n }\n obj.greeting=str1;\n obj.name=str2;\n return obj;\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 864ms, 内存消耗: 77900KB, 提交时间: 2020-11-28
{"css":"","js":"function createModule(str1, str2) {\n\n function Obj()\n {\n this.greeting = str1;\n this.name = str2;\n }\n Obj.prototype.sayIt = function(){return this.greeting + \", \" + this.name;}\n return new Obj(); \n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 866ms, 内存消耗: 77860KB, 提交时间: 2020-11-22
{"css":"","js":"function createModule(str1, str2) {\n return {\n greeting: str1,\n name: str2,\n sayIt: function(){\n return this.greeting + ', ' + this.name\n }\n }\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 867ms, 内存消耗: 77828KB, 提交时间: 2020-12-29
{"css":"","js":"function createModule(str1, str2) {\n var obj = {\n greeting:str1,\n name:str2,\n sayIt:function(){\n return this.greeting+ ', ' +this.name\n }\n }\nreturn obj\n}","html":"","libs":[]}