• + 1 comment

    or in JS:

    let max;

    if (typeof max !== 'number' || sum > max) { max = sum }