Your code resets biggestNumber to zero when checking a new sub array. If all of the numbers in a sub array are negative, your code logic would say that zero is the largest number instead of the largest negative number in the sub array.

For example, if you had the following sub array: [ -100, -6, -15, -30], the largest number is -6, but your code would say the largest number is zero. Think about how you can compare each number to itself in each sub array instead of assuming the smallest number possible is zero.

Does it pass the tests? If so, it appears you have solved the challenge. Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution.

I know I have explained this many times in the past, so can you please learn how to put 3 backticks on the line before and after any code you post, so that it properly displays on the page?

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

you are adding the biggest number to your answer array at the index of i;
arrays are designed to add continuous values so instead of using the index to add the biggest element to answer array use the push method as

answer.push(biggestNumber);

here’s my simple solution to this problem

function largestOfFour(arr) {
let newarr=[];
for(let i=0;i < arr.length ; i++){
let largest=arr[i].reduce((acc,val)=>{
if(val > acc){
acc = val;
}
return acc;
});
newarr.push(largest);
}
return newarr;
}

to get the most out of the free code camp challenges I recommend executing the challenges first in our local environment because this will help you think thoroughly over the problem and you can try your mistakes yourself by debugging.