Tell us what’s happening:
Describe your issue in detail here.
trying to figure out how to get the largest number in the negative Array
function largestOfFour(arr) {
let result = [];
for (let i = 0; i < arr.length; i++) {
let highestNum = 0;
for (let j = 0; j < arr[i].length; j++) {
let individualArray = arr[i][j];
if (individualArray > highestNum ) {
highestNum = individualArray;
}
}
result.push(highestNum)
}
return result;
}
console.log(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Challenge: Basic Algorithm Scripting - Return Largest Numbers in Arrays
Link to the challenge: