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.
you can try:
(max < b) && (max = b);
look at this example:
let max = 10; let b = 15; (max < b) && (max = b)// this will be true console.log("max=", max); let maxx = 10 let bb = 5; (maxx < bb) && (maxx = bb)// this will be false console.log("maxx=", maxx);