Analyzing a Javascript Expression That is Always True | Task

Ole Ersoy
Jun - 14  -  1 min

Scenario

We have a Javascript array arr that has a length other than zero.

And the expression:

arr.length !=7 || arr.length !=4

This expression is always true. lets see why.

Approach

Suppose the length is 7. In this case arr.length !=7 is false, but arr.length !=4 is true.

Suppose the length is 4. In this case arr.length !=7 is true, so we stop.

Thus we can see that no matter what length is plugged in the expression is always true.