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 197 views
1 answer 258 views
1 answer 237 views
1 answer 262 views
1 answer 268 views
1 answer 217 views
...