Is it possible to do something like this in JavaScript?
max = (max < b) ? b;
In other words, assign value only if the condition is true.
An expression with ternary operator must have both values, i.e. for both the true and false cases.
You can however
max = (max < b) ? b : max;
in this case, if condition is false, value of max will not change.
max