Answers for "how to find index of biggest number array javascript"

9

find biggest number in javascript array

var peopleData = [ 
    { name: "Paul", height: 180, age: 21 },
    { name: "Johnny", height: 198, age: 43 },
    { name: "Brad", height: 172, age: 49 },
    { name: "Dwayne", height: 166, age: 15 }
];

//Find biggest height number
var maxHeight = 0;

for (var i = 0; i < heights.length; i++) {
    if (peopleData[i].height > maxHeight) {
        maxHeight = peopleData[i].height;
      //if you console.log(maxHeight); you should get 198
    }
}
Posted by: Guest on May-19-2021
0

javascript index of biggest number

arr.indexOf(Math.max(...arr))
Posted by: Guest on December-20-2019

Code answers related to "how to find index of biggest number array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language