Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find max value in javascript

x = findMax(1, 123, 500, 115, 44, 88);

function findMax() {
  var i;
  var max = -Infinity;
  for (i = 0; i < arguments.length; i++) {
    if (arguments[i] > max) {
      max = arguments[i];
    }
  }
  return max;
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #find #max #javascript
ADD COMMENT
Topic
Name
7+9 =