How to get the min and max values in an object with TypeScript

1 Answer

0 votes
const obj = {
  	code1: 65,
  	code2: 24,
  	code3: 99,
  	code4: 17,
  	code5: 89
};

const values = Object.values(obj);

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

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

  
  
  
  
/*
run:
  
99 
17 
  
*/

 



answered Jul 9, 2022 by avibootz

Related questions

1 answer 173 views
1 answer 175 views
1 answer 160 views
1 answer 144 views
1 answer 193 views
1 answer 150 views
...