find max value in javascript

Solutions on MaxInterview for find max value in javascript by the best coders in the world

showing results for - "find max value in javascript"
Valerio
22 Sep 2018
1x = findMax(1, 123, 500, 115, 44, 88);
2
3function findMax() {
4  var i;
5  var max = -Infinity;
6  for (i = 0; i < arguments.length; i++) {
7    if (arguments[i] > max) {
8      max = arguments[i];
9    }
10  }
11  return max;
12}
13