-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