How to replace all spaces with dashes in a string with Node.js

1 Answer

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

*/

 



answered Apr 26, 2022 by avibootz
...