0👍
Here is the solution.
Please use regex expression instead of ’23’ string.
str = '236112456';
var result = str.replaceAll(/236/gi, '236.jpg').replaceAll(/1/gi, '1.jpg');
...
The result is "236.jpg1.jpg1.jpg2456"
. Is this not what you are looking for ?
- [Vuejs]-Choose which component to show on certain route in Vue.js
- [Vuejs]-Vue resource interceptor to refresh JWT token
Source:stackexchange.com