[removed] final / immutable global variables?

前端 未结 14 2071
既然无缘
既然无缘 2020-12-13 09:03

I think I know the answer but... is there any way to prevent a global variable from being modified by later-executing

14条回答
  •  轮回少年
    2020-12-13 09:35

    try this:

    const whatEver = 'Hello World!!!';
    
    function foo(value){
     whatEver = value;
    }
    

    then you would call it like so...

    Change Me First
    Then click me After: Should Be alert "Hello World!!!"

提交回复
热议问题