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 115 views
1 answer 147 views
1 answer 147 views
1 answer 175 views
1 answer 140 views
1 answer 157 views
1 answer 179 views
...