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
the const keyword?
I know this question is old, but you could use Object.freeze(yourGlobalObjectHere); I just wrote a blog post about it here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With