Greetings.
I found a mistake in the right answer, i believe.
Array.zip() by definition takes 2 arrays and a function as arguments.
But when we are using the result of reduce function on an array of objects as an argument for our Array.zip() function, it will return a single object, not an array with an object in it.
I was able to fix it by wrapping return result of reduce function with square brackets.
Greetings. I found a mistake in the right answer, i believe. Array.zip() by definition takes 2 arrays and a function as arguments. But when we are using the result of reduce function on an array of objects as an argument for our Array.zip() function, it will return a single object, not an array with an object in it. I was able to fix it by wrapping return result of reduce function with square brackets.
return Array.zip( video.boxarts.reduce(function(acc,curr) { if (acc.width * acc.height < curr.width * curr.height) { return [acc]; } else { return [curr]; } });
Am i correct on this or am i missing something?
Thank you.