What is the fastest way to replace all instances of a string/character in a string in JavaScript? A while
, a for
-loop, a regular expression?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- how to split a list into a given number of sub-lis
What's the fastest I don't know, but I know what's the most readable - that what's shortest and simplest. Even if it's a little bit slower than other solution it's worth to use.
So use:
And enjoy good code instead of faster (well... 1/100000 sec. is not a difference) and ugly one. ;)