Or
视频锁定
{$ currentTime | date:'mm:ss' $}
{$ timeLeft | date:'mm:ss' $}
逻辑运算符or
在javascript中是这样写的 ||
,当两个表达式中有一个为true
时,结果为true
,当两个都是false
时结果为false
。
true || true; // => true
true || false; // => true
false || true; // => true
false || false; // => false
Or
操作符是两个竖线,在键盘的enter键上面。
说明:
- 创建两个变量:
tired
和bored
,并设置其中一个等于true
,另一等于false
。 - 在
nap
函数中,创建一个if
语句,如果tired
或bored
有一个为true
(或两个都为true),返回true
,否则,返回false
。
在线练习
{$ activeFileHint $}