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 217 views
1 answer 214 views
1 answer 206 views
1 answer 342 views
1 answer 201 views
1 answer 202 views
...