FED57. 函数的上下文
描述
将函数 fn 的执行上下文改为 obj 对象示例1
输入:
function () {return this.greeting + ', ' + this.name + '!!!';}, {greeting: 'Hello', name: 'Rebecca'}
输出:
Hello, Rebecca!!!
HTML/CSS/JavaScript 解法, 执行用时: 842ms, 内存消耗: 77772KB, 提交时间: 2020-12-23
{"css":"","js":"function speak(fn, obj) {\n return fn.call(obj);\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 842ms, 内存消耗: 77856KB, 提交时间: 2021-06-26
{"css":"","js":"function speak(fn, obj) {\n \n return fn.call(obj) \n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 843ms, 内存消耗: 77772KB, 提交时间: 2021-04-24
{"css":"","js":"function speak(fn, obj) {\n return fn.call(obj, arguments)\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 843ms, 内存消耗: 77772KB, 提交时间: 2020-12-24
{"css":"","js":"function speak(fn, obj) {\n return fn.call(obj)\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 843ms, 内存消耗: 77772KB, 提交时间: 2020-11-18
{"css":"","js":"function speak(fn, obj) {\n return fn.call(obj);\n}","html":"","libs":[]}