Use compund Math.max within Math.max to compare 3 elements