How to get the N element of a set in TypeScript

1 Answer

0 votes
const st = new Set(['typescript', 'java', 'php', 'javascript', 'node.js', 'c++']);
  
const N = 2;
 
const N_element = [...st][N];
 
console.log(N_element); 
 
  
  
  
   
/*
run:
   
"php"
   
*/

 



answered Jul 10, 2022 by avibootz

Related questions

2 answers 253 views
2 answers 270 views
1 answer 167 views
1 answer 206 views
1 answer 185 views
185 views asked Aug 13, 2022 by avibootz
3 answers 345 views
...