JavaScript logical AND operation, if the previous expression is true, then the value of the second expression is returned.
However, the return value of the expression return a is an "Illegal return statement", that is to say, it neither returns undefined, nor null or empty value, but should not return anything at all. Therefore, an error will be reported.
JavaScript logical AND operation, if the previous expression is true, then the value of the second expression is returned.
However, the return value of the expression return a is an "Illegal return statement", that is to say, it neither returns undefined, nor null or empty value, but should not return anything at all. Therefore, an error will be reported.
Can return be placed in an expression?
return a==b?a:undefined