Explanation: re=new RegExp("l","g") The first parameter is the string you want to replace, and the second parameter refers to the replacement All of them, the second parameter can also be set to ("i"), which means only the first string is replaced.
The second parameter in str.replace(re, "t") is the string you want to modify.