How to replace all spaces with dashes in a string with TypeScript

1 Answer

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

 



answered Apr 26, 2022 by avibootz
...