Try manually setting upper and lower to different example arrays, and examine the result of this expression. I think you’ll be surprised by the outcome.
let upper = ['C','O','D']
let lower = ['e']
console.log(upper && upper.length > lower && lower.length)
and to substitute different values for upper and lower. You can do all of that inside the function too, but sometimes it’s easier to debug line by line without it all being inside a function.
I think the original issue was that the conditional was being evaluated left to right rather than the items around the &&s being grouped. So it was evaluating this way:
// Assume upper == ['C', 'O', 'D'] and lower == ['e']
upper && upper.length // 3
upper && upper.length > lower // equivalent to "3 > lower" which is actually false (oh no!)
upper && upper.length > lower && lower.length // equivalent to "false && 1" which is false
I suspect if you add some ()s around the && terms of your original solution, it will behave as expected. Greater than / less than comparisons get pretty weird when arrays are compared – JS actually converts the array to a string value first.