How to add space after each comma in a string in TypeScript

1 Answer

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

str = str.replaceAll(',', ', ');

console.log(str); 

  
  
  
  
/*
run:
  
"javascript, c++, c, typescript, node.js, python" 
  
*/

 



answered May 2, 2022 by avibootz
...