How to replace all forward slashes in a string with JavaScript

1 Answer

0 votes
let str = '/javascript/c/java';

str = str.replaceAll('/', '$');

console.log(str);
    
    
    
    
/*
run:
    
"$javascript$c$java"
    
*/

 



answered Jul 2, 2022 by avibootz
...