const boxes = [[2, 3, 4], [1, 1, 10]];
function total_surface_area(boxes) {
return boxes.reduce((acc, box) => {
const sides = [box[0]*box[1], box[1]*box[2], box[2]*box[0]];
const smallest_side = Math.min(...sides);
const box_surface = ((sides[0] + sides[1] + sides[2]) * 2) + smallest_side;
return acc + box_surface;
}, 0);
}
console.log(total_surface_area(boxes));