3
Lua中,我能做到以下幾點:Javascript:在JavaScript中是否有相當於lua的_G?
_G.print("Hello world")
print("Hello world")
它都將打印相同的字符串到屏幕上。 有沒有辦法在javascript中訪問全局對象?我的意思是像
_G.console.log === console.log
true
這將是我的使用情況下,真正有用的(我想阻止我的網站上的任何代碼注入掃描更改全局對象)
我認爲這是'window'你找......對於如'window.console.log' –
它不工作在node.js(我preffer一個通用的解決方案) – Rph