How to eliminate the closure of javascript

Today"s interview encountered such a question: how to eliminate javascript closures
there are several questions here. I feel that the variables returned by closures will be eliminated automatically if they are not referenced. However, I was a little confused when I searched some articles on the Internet, saying that closures will cause resident memory, memory leakage, etc.

Mar.14,2022

closure means that when a function is called, it can access the scope that the function can access when it is defined, for example, when defining the function a, a can access the variable b. Each function has its own closure, and when the function is not reclaimed by the garbage collection mechanism, the corresponding closure of the function will also be resident in memory. If you need to clear closures, you have to recycle unwanted functions. According to the JavaScript recycling mechanism, a memory space will be reclaimed when there is no variable pointing to it. Then the way to clear closures is to assign unwanted function names to null.


https://developer.mozilla.org.
look at this


so now you don't have to worry about memory leaks caused by closures?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b41ccc-2c5cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b41ccc-2c5cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?