> 
> *str.indexOf(searchValue[, fromIndex])*
> 
> 
> The index of the first occurrence of searchValue, or **-1 if not found**.
> 
> 
> - [MDN web docs](https://developer.mozilla.org)
> 
> 
> 

Why was `-1` chosen to be the returned value by `.indexOf` if it doesn't find a match in the array?

```js
console.log([].indexOf()) // -> -1

```

Would it not be more suitable to have `0` instead? It would make sense because there are indeed `0` matching element. And this way we could have used it directly in a conditional statement, for example:

```
if( Array.indexOf(String) ) { ... }

```

Instead of

```
if( Array.indexOf(String) !== -1 ) { ... }

```

Why is that? Any particular reason? I've seen the same in Java, C++ and C. Is this because of how the native function was designed?