You are not using the conditional operator correctly as the if , so you get this note. The real work in the code is performed as a side effect of the expression, and the result of the expression is ignored.
As a real if , it will be:
if (dir === 'next') { ++$currentSlide; } else { --$currentSlide; }
You can use the conditional operator if you use it as an actual expression:
$currentSlide += dir === 'next' ? 1 : -1;
Guffa
source share