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 203 views
1 answer 262 views
1 answer 241 views
1 answer 266 views
1 answer 274 views
1 answer 222 views
...