How to remove all occurrences of a character in a string with Node.js

2 Answers

0 votes
let str = "node.js programming version 18.4.0";
  
str = str.replace(/s/g, 'K') 
  
console.log(str);
   
   
 
       
/*
run:
    
node.jK programming verKion 18.4.0
     
*/

 



answered Jun 30, 2022 by avibootz
0 votes
let str = "node.js programming version 18.4.0";
  
str = str.replaceAll('s', 'K');
  
console.log(str);
   
   
 
       
/*
run:
    
node.jK programming verKion 18.4.0
     
*/

 



answered Jun 30, 2022 by avibootz
...