How to replace multiple characters in a string with other characters using TypeScript

1 Answer

0 votes
let str = 'java-script.type-script.c.php-.c++';
 
str = str.replaceAll('.', ' ').replaceAll('a', 'X').replaceAll('-', '');
   
console.log(str); 
 
 
 
 
   
/*
run:
   
jXvXscript typescript c php c++
   
*/

 



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