JavaScript shorthand if statement, without the else portion

you can use && operator – second operand expression is executed only if first is true

direction == "right" && slideOffset += $(".range-slide").width()

in my opinion if(conditon) expression is more readable than condition && expression

Leave a Comment