How to get the min and max values in a map with Node.js

1 Answer

0 votes
const mp = new Map([
  ['javascript', 414],
  ['nodejs', 991],
  ['typescript', 378],
  ['c++', 825],
]);
 
const min = Math.min(...mp.values());
console.log(min);

const max = Math.max(...mp.values());
console.log(max);
 
    
    
    
    
/*
run:
    
378
991
    
*/

 



answered May 14, 2022 by avibootz

Related questions

1 answer 117 views
1 answer 103 views
1 answer 100 views
1 answer 138 views
1 answer 118 views
1 answer 128 views
...