How to concatenate strings with a separator in Node.js

1 Answer

0 votes
const str1 = 'nodejs';
const str2 = 'c';
const str3 = 'c++';

const str = [str1, str2, str3].join('-');

console.log(str); 


  
  
  
  
/*
run:
  
nodejs-c-c++
  
*/

 



answered May 29, 2022 by avibootz

Related questions

1 answer 182 views
3 answers 147 views
2 answers 179 views
1 answer 123 views
1 answer 120 views
...