js replace space with plus

Solutions on MaxInterview for js replace space with plus by the best coders in the world

showing results for - "js replace space with plus"
Manuela
05 Jul 2019
1// replaces space with '+'
2str = str.replace(/ /g, "+");
3// or
4str = str.split(' ').join('+');