How to reverse the order of a set in Node.js

1 Answer

0 votes
let st = new Set(['typescript', 'javascript', 'node.js', 'c++', 'python']);
 
st = new Set(Array.from(st).reverse());
 
console.log([...st].join(' '));
    
        
        
         
/*
run:
         
python c++ node.js javascript typescript
         
*/

 



answered May 17, 2022 by avibootz

Related questions

1 answer 140 views
1 answer 85 views
1 answer 107 views
1 answer 126 views
1 answer 118 views
1 answer 108 views
...