You can use Math.max to get a maximum of two values, highest and pf[i].length .
highest = Math.max(highest, pf[i].length);
Or you can also use the ternary operator.
highest = pf[i].length > highest ? pf[i].length : highest; // ^^^^^^^^^^^^^^^^^^^^^^ Condition // ^^^^^^^^^^^^ Execute when True // ^^^^^^^ Execute when False
The value from the ternary operation is returned and set to the highest variable.
source share