Skip to content
Advertisement

Tag: conditional-statements

How does this conditional statement work?

This function finds the middle value of an array. But the conditional statement makes no sense to me, since arr.length === 0 is never true but the function still works for both even and odd numbers. I think the condition should be arr.length % 2 !== 0 and it works too, but even then I don’t see how the correct

Advertisement