The logic that it is exactly the same, and there's no "better" way between the two. At this point it's mostly semantics: do you want to indicate that one before the current one is the same as the length of the imgs, or do you want to indicate that the length of the imgs is one smaller than the current one. For example:
I want to see if I will have enough money to buy this toy after receiving another penny:
if (currentCash + 0.01 === toyPrice) {}
I want to see if the price of this toy costs exactly 1 penny more than what I currently have:
if (currentCash === toyPrice - 0.01) {}
Again, it's just semantics at this point: what are you trying to say in this if-statement?