How to iterate over a set in reverse order in Node.js

1 Answer

0 votes
const st = new Set(['typescript', 'javascript', 'node.js', 'c++', 'c#']);

Array.from(st)
   .reverse()
   .forEach(element => {
    	  console.log(element); 
   });
  
  
  
  
/*
run:

c#
c++
node.js
javascript
typescript

*/

 



answered Apr 14, 2022 by avibootz

Related questions

2 answers 117 views
2 answers 156 views
156 views asked Feb 28, 2022 by avibootz
1 answer 116 views
1 answer 98 views
1 answer 102 views
3 answers 79 views
...