Javascript:final / immutable全局变量? [英] Javascript: final / immutable global variables?
本文介绍了Javascript:final / immutable全局变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想我知道答案但是......有没有办法阻止全局变量被后来执行的< script>
修改?我知道全局变量首先是坏的,但是在必要时,有没有办法让它最终或不可变?欢迎黑客/创意解决方案。谢谢
I think I know the answer but... is there any way to prevent a global variable from being modified by later-executing <script>
? I know global variables are bad in the first place, but when necessary, is there a way to make it "final" or "immutable"? Hacks / creative solutions are welcome. Thanks
推荐答案
const 关键字?
the const keyword?
这篇关于Javascript:final / immutable全局变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文