I was viewing the intermediate code solution on https://forum.freecodecamp.org/t/freecodecamp-algorithm-challenge-guide-return-largest-numbers-in-arrays/16042 and noticed the unusual notation style used on the innermost return statement (current > prev) ? current : prev;. Can anyone explain it to me? Thank you in advance.
(current > prev) ? current : prev;
It’s a ternary operator. It is a shorthand of if else.
If the condition is true, it returns current else prev.