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 186 views
1 answer 161 views
1 answer 161 views
1 answer 154 views
2 answers 168 views
1 answer 137 views
...