]
Supplementary:
The code is as follows:
eval("str = str.replace(/" getStr "/g, '')");
Many people may want to write str = str.replace(/getStr/g,"), but the result will be wrong. Why, in this sentence. The regular expression matches the getStr string, not the first letter pointed to by getStr. This can be avoided through the eval method (first getStr gets the first letter pointed to, and uses string concatenation "str = str.replace(/" getStr "/g, ")", and finally execute this code in eval, that is: interpret the Javascript code first, and then execute it).
Due to the poor performance of eval, it is error-prone and has poor readability. It is recommended to change eval(”str = str.replace(/” getStr ”/g,”)”) to: str = str.replace(new RegExp(getStr,"g"),"")