How to get the min and max values in a set with TypeScript

1 Answer

0 votes
const st = new Set([49, 98, 16, 38, 10, 73, 60]);

const min = Math.min(...st);
console.log(min);

const max = Math.max(...st);
console.log(max); 

 
    
    
    
    
/*
run:
    
10
98
    
*/

 



answered May 14, 2022 by avibootz

Related questions

1 answer 191 views
1 answer 245 views
1 answer 241 views
1 answer 273 views
1 answer 221 views
1 answer 246 views
1 answer 261 views
...