填充现有的switch语句
视频锁定
{$ currentTime | date:'mm:ss' $}
{$ timeLeft | date:'mm:ss' $}
Switch语句就像是这样:
switch (/*Some expression*/) {
case 'option1':
// Do something
break;
case 'option2':
// Do something else
break;
case 'option3':
// Do a third thing
break;
default:
// Do yet another thing
}
JavaScript将尝试匹配switch()
语句大括号中的每种情况。如果找到一个匹配,它将运行下面的代码。如果没有找到匹配将执行默认选项处代码。
在线练习
{$ activeFileHint $}