In JavaScript, rather than having to assign the result to a variable, is it possible to return the result of a ternary in one line of code?
return
e.g. Instead of
Yes. It's possible. Also you can make your code even more compact.
function isAGreaterThanB(){ return a > b; }
Above code will return true if a is greater, false if not.
true
a
false