SoFunction
Updated on 2025-03-01

How to delete local variables by js

alert('value:'+str+'\ttype:'+typeof(str)) //Before declaring the variable, reference

var str="dd";

alert('value:'+str+'\ttype:'+typeof(str)) //After declaring and assigning variables, reference

str=undefined; //Delete local variables

alert('value:'+str+'\ttype:'+typeof(str)) //After canceling the variable, the reference is the same as the first one

The above is all the implementation methods of deleting local variables brought to you by the editor. I hope everyone supports me~