How to convert array to comma separated string in TypeScript

2 Answers

0 votes
const arr = ['typescript', 'c', 'c++'];
 
const str = arr.join(',');
 
console.log(str);

 
   
   
   
   
/*
run:
   
"typescript,c,c++" 
   
*/

 



answered Jun 22, 2022 by avibootz
0 votes
const arr = ['typescript', 'c', 'c++'];
 
const str = String(arr);
 
console.log(str);

 
   
   
   
   
/*
run:
   
"typescript,c,c++" 
   
*/

 



answered Jun 22, 2022 by avibootz

Related questions

...