且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

javascript简写if语句,没有else部分

更新时间:2022-11-04 12:42:54

你可以使用&& 运算符 - 第二个操作数表达式只有在第一个是true

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

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

在我看来 if(conditon)表达式 condition&&表达式