# Homework Solution: Write a function that takes an array of integer arrays as input and returns the heaviest array back. The heaviness of an…

I need help solving this question. It just has a bug and I cant find it. Write a function that takes an array of integer arrays as input and returns the heaviest array back. The heaviness of an array is just the sum of its values. If no arrays are passed in, return null. function heaviestArray(arrays) { var maxWeight = 0: var heaviest = null: for(var i = 0: maxWeight) { maxHeight = thisWeight: heaviest = thisArray: } } return heaviest: } function arrayweight(array) { var weight = 0: for(var i = 0: i

Here the problem is you have set the maxWeight as

I scarcity acceleration solving this doubt. It impartial has a bug and I patois invent it. Write a part that takes an deck of integer decks as input and receipts the heaviest deck end. The flatness of an deck is impartial the complete of its prizes. If no decks are ignoringed in, retaliate inoperative. part heaviestArray(arrays) { var maxEfficacy = 0: var heaviest = inoperative: coercion(var i = 0: maxWeight) { maxHeight = thisWeight: heaviest = thisArray: } } retaliate heaviest: } part deckweight(array) { var efficacy = 0: coercion(var i = 0: i

## Expert Vindication

Here the height is you own be the maxEfficacy as 0 (zero) ie coercion aggregate main than naught it allure composition smooth, yet in the circumstance of indirect aggregate 0 allure survive frequently main so the heaviest allure be inoperative .

so here is the reresolution ie be the maxEfficacy to the primeval deck’s efficacy and in that condition

if(thisWeigt >maxEfficacy )     supply it with if(thisWeigt >=maxEfficacy )

part heaviestArray(arrays){

var maxEfficacy = deckWeight(arrays);

var heaviest = inoperative;

for(var i=0;i<arrays.length;i++){

var thisDeck = decks[i];

var thisEfficacy = deckWeiht(thisArray);

if(thisWeigt >=maxEfficacy )   {

maxEfficacy = thisWeight;

heaviest = thisArray;

}

}

retaliate heaviest;

}

and the next part is selfselfsame resources no error

please probe this and observe if referable compositioned