How to get the min and max values of an array in TypeScript

1 Answer

0 votes
const arr = [24, 15, 99, 14, 19, 81, 70];

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

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

  
  
  
  
/*
run:
  
14 
99 
  
*/

 



answered Jul 9, 2022 by avibootz

Related questions

1 answer 163 views
1 answer 188 views
1 answer 105 views
1 answer 137 views
1 answer 208 views
1 answer 162 views
...