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

1 Answer

0 votes
const st = new Set([4, 9, 6, 8, 1, 7, 6]);

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

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

 
    
    
    
    
/*
run:
    
1
9
    
*/

 



answered May 14, 2022 by avibootz
...