How to replace all forward slashes in a string with Node.js

1 Answer

0 votes
let str = '/node.js/c/python/c++';

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

console.log(str);
    
    
    
    
/*
run:
    
$node.js$c$python$c++
    
*/

 



answered Jul 2, 2022 by avibootz

Related questions

1 answer 136 views
1 answer 138 views
1 answer 139 views
1 answer 264 views
1 answer 119 views
1 answer 124 views
...