How to find the min and max of an int array in Node.js

1 Answer

0 votes
const array = [42, 85, 19, 73, 60, 3, 28, 94, 31, 53, 67];
 
const min = Math.min(...array);
const max = Math.max(...array);
 
console.log(`Minimum: ${min}`);
console.log(`Maximum: ${max}`);
 
 
 
/*
run:
 
Minimum: 3
Maximum: 94
 
*/

 



answered Jan 16, 2025 by avibootz

Related questions

1 answer 125 views
1 answer 131 views
1 answer 153 views
1 answer 156 views
...