Question: ```
$scope.vergleich = function () {
    if ($scope.relrechtsform.indexOf(dataService.dic.alt.rechtsformKanlei || dataService.dic.neu.rechtsformKanlei ) !== -1) {
        return true
    } else {
        return false;                   }
    }
}

```

I am currently student and intelliJ tells me I have to simplify this if-statement but I have no idea how. Maybe somebody can help me.

Answer: 
The simplification is probably that, if `condition` is a boolean, :

```
if (condition) { 
  return true;
} 
else { 
  return false;
}

```

is equivalent to 

```
return condition;

```

**However** there also seems to be a logical error in your test.

```
$scope.relrechtsform.indexOf(dataService.dic.alt.rechtsformKanlei ||
                        dataService.dic.neu.rechtsformKanlei ) !== -1

```

Does **not** mean the same thing as :

```
$scope.relrechtsform.indexOf(dataService.dic.alt.rechtsformKanlei) !== -1 || 
$scope.relrechtsform.indexOf(dataService.dic.neu.rechtsformKanlei) !== -1

```
[Tân's version](https://stackoverflow.com/a/59893737/6320039) is a correct answer to your question. However, with recent JavaScript you can simplify even more thanks to [`array.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes):

```js
$scope.vergleich = () =>
    $scope.relrechtsform.includes(dataService.dic.alt.rechtsformKanlei || dataService.dic.neu.rechtsformKanlei)

```