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 156 views
1 answer 179 views
1 answer 95 views
1 answer 126 views
1 answer 193 views
1 answer 151 views
...