How to convert array to comma separated string in Node.js

2 Answers

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

 
   
   
   
   
/*
run:
   
node.js,c,c++
   
*/

 



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

 
   
   
   
   
/*
run:
   
node.js,c,c++
   
*/

 



answered Jun 22, 2022 by avibootz

Related questions

1 answer 175 views
1 answer 155 views
1 answer 151 views
1 answer 145 views
2 answers 160 views
1 answer 129 views
...