man*_*i77 2 javascript ternary-operator angularjs eslint atom-editor
代码段:
$scope.IsVisible = false;
$scope.ShowHide = function () {
$scope.IsVisible = $scope.IsVisible ? false : true; // error
};
Run Code Online (Sandbox Code Playgroud)
得到此ESLint错误:错误在条件表达式no-unneeded-ternary中不必要地使用布尔文字
尝试好方法=).在这种情况下无需使用语句.
$scope.IsVisible = !$scope.IsVisible;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4979 次 |
| 最近记录: |