I am simply console logging the list of array with the variable temp I defined as showen below. but output only shows the third element on the array. what is this reason for not listing every element? because when I simply console log arr[i], it shows all 3 elements in the array but not with the vairable temp.
here is my code
function largestFour(arr){
var max = [];
for ( var i = 0; i < arr.length; i++)
var temp = arr[i];
console.log(temp);
}
largestFour([[4,5,1,3],[13,27,16,5],[10,19,4,9]]);
output
(4)[10,19,4,9]
tempvariable is the lastarr[i]which is the last element of your list (so the last array). I think that for what you want to, you are missing{}enclosing the logic in the for