How to replace the first occurrence of character in string with Node.js

1 Answer

0 votes
let str = 'javascript typescript node.js python';

str = str.replace(/e/i, '*');

console.log(str); 

  
  
  
  
/*
run:
  
javascript typ*script node.js python
  
*/

 



answered Jun 13, 2022 by avibootz
...