function solution(sizes) {
let maxWidth = 0;
let maxHeight = 0;
const convertSizes = sizes.map(([w, h]) => {
if(w < h){
return [h, w];
}
return [w, h];
});
for(let i = 0; i < convertSizes.length; i++){
const [w, h] = convertSizes[i];
maxWidth = Math.max(maxWidth, w);
maxHeight = Math.max(maxHeight, h);
};
return maxWidth * maxHeight;
}