-2
你能帮助我吗?JavaScript测试
在测试过程中,我不明白这个问题:
考虑下面的代码,编写JavaScript的两行调用
print()
功能,打印在 的JavaScript窗口全局对象的方式安慰?您的代码不得使用变量window
。随意发表评论。Printer = function(){ this.print = function() { console.log(this); } } var printer = new Printer();
请更具体...你不明白什么?我们不介意读者。现在将是阅读[问]和[问题清单]的好时机(http://meta.stackoverflow.com/questions/260648/stack-overflow-question-checklist) – charlietfl
谢谢你的回答,我不明白如何执行此操作:以不使用变量窗口的方式打印Window全局对象,调用print()函数。 – souf
试试'printer.print.call(this)' – charlietfl