How to replace multiple characters in a string with other characters using Node.js

1 Answer

0 votes
let str = 'node-js.type-script.c.php-';

str = str.replaceAll('.', ' ').replaceAll('s', 'X').replaceAll('-', '');
  
console.log(str); 




  
/*
run:
  
nodejX typeXcript c php
  
*/

 



answered Apr 28, 2022 by avibootz
edited Apr 28, 2022 by avibootz
...