How to find max value from an array in JavaScript ES6

2 Answers

0 votes
console.log(Math.max(...[87, 12, 99, 80, 17]));


     
/*
run:
   
99
 
*/

 



answered Mar 8, 2020 by avibootz
0 votes
const arr = [87, 120, 99, 80, 17];

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


     
/*
run:
   
120
 
*/

 



answered Mar 8, 2020 by avibootz

Related questions

1 answer 195 views
1 answer 255 views
1 answer 234 views
1 answer 259 views
1 answer 263 views
1 answer 215 views
...