Why do the above error reports occur
If you see the error “typeerror: replaceall is not a function”, it may be that your browser version or node.js version does not support this method.
we should note that: string. Prototype. Replaceall() The method is added in ES2021/ES12, which is probably not supported by the environment.
How to solve it?
You can use “string. Prototype. Replace()” as a substitute for “string. Prototype. Replaceall()”,
replace() Just set a global (g) in the replaced regular expression. This processing method is the same as that of replaceall(). Here is an example of comparison:
const str = 'foo-bar'; // in older browsers const result1 = str.replace(/foo/g, 'moo'); // ES12+ const result2 = str.replaceAll('foo', 'moo'); // output: 'moo-bar' console.log(result1); console.log(result2);
- [Solved] Vue route Duplicate Error: error avoid redundant navigation to current location: “/home”
- How to Use Array.prototype.slice.call(arguments)
- URL transcoding (including Chinese): 3A to ‘:’,% 2F to ‘/’
- Solution to the problem of “TypeError: Assignment to constant variable”
- [Solved] Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location
- [Solved] Vue Error: Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location
- core-js & RegExp error All In One [How to Solve]
- [Solved] Clang: error: linker command failed with exit code 1
- [Solved] Undefined reference_G++ _GLIBCXX_USE_CXX11_ ABI compilation error: STD:: Basic_String and STD::__cxx11::basic_String cannot match
- Error reporting and resolution of Python 3 using binascii method