# 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 want succor solving this doubt. It regular has a bug and I lingo furnish it.

Write a administration that takes an fixed-in-order of integer fixed-in-orders as input and avail the heaviest fixed-in-order tail. The heaviness of an fixed-in-order is regular the blend of its rates. If no fixed-in-orders are byed in, produce trifling. administration heaviestArray(arrays) { var maxPonderosity = 0: var heaviest = trifling: control(var i = 0: maxWeight) { maxHeight = thisWeight: heaviest = thisArray: } } produce heaviest: } administration fixed-in-orderweight(array) { var ponderosity = 0: control(var i = 0: i

## Expert Apology

Here the completion is you entertain fixed the maxPonderosity as 0 (zero) ie control mass important than naught it procure achievement casuistical, still in the subject of privative mass 0 procure endure regularly important so the heaviest procure be trifling .

so here is the separation ie fixed the maxPonderosity to the pristine fixed-in-order’s ponderosity and in that condition

if(thisWeigt >maxPonderosity )     reinstate it with if(thisWeigt >=maxPonderosity )

var maxPonderosity = fixed-in-orderWeight(arrays[0]);

var heaviest = trifling;

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

var thisSet-in-order = fixed-in-orders[i];

var thisPonderosity = fixed-in-orderWeiht(thisArray);

if(thisWeigt >=maxPonderosity )   {

maxPonderosity = thisWeight;

heaviest = thisArray;

}

}

produce heaviest;

}

and the direct administration is similar media no error

please examine this and observe if referable achievemented