How to convert multiple sets to an array in Node.js

1 Answer

0 votes
const set1 = new Set(['typescript', 'javascript', 'node.js']);
const set2 = new Set(['c', 'c++', 'python']);
 
const arr = [...set1, ...set2];
 
console.log(arr);
 
 
 
  
/*
run:
  
[ 'typescript', 'javascript', 'node.js', 'c', 'c++', 'python' ]
  
*/

 



answered Feb 27, 2022 by avibootz

Related questions

1 answer 125 views
1 answer 111 views
1 answer 107 views
1 answer 123 views
2 answers 143 views
1 answer 111 views
...