Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find the largest number in array javascript

const result = (data) => {
  let max = 0;
  for (let i = 0; i < data.length; i++) {
    if (data[i] > max) {
      max = data[i];
    }
  }
  console.log("===> :: max", max);
}

const inputData = [2, 3, 5, 4, 54, 69, 4, 44, 3, 6, 45, 6, 4, 6]
result(inputData);
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #find #largest #number #array #javascript
ADD COMMENT
Topic
Name
5+3 =