有没有更好的方法来处理检查多个值.当我有超过3个选择时,它开始变得非常忙碌.
if (myval=='something' || myval=='other' || myval=='third') {
}
Run Code Online (Sandbox Code Playgroud)
PHP有一个名为的函数in_array(),如下所示:
in_array($myval, array('something', 'other', 'third'))
Run Code Online (Sandbox Code Playgroud)
在js或jquery中有类似的东西吗?
| 归档时间: |
|
| 查看次数: |
1878 次 |
| 最近记录: |