How to concatenate strings with a separator in JavaScript

1 Answer

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

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

console.log(str); 


  
  
  
  
/*
run:
  
"javascript-c-c++"
  
*/

 



answered May 29, 2022 by avibootz
...