Question: I've tried to build <https://github.com/DEVSENSE/Phalanger>, but after the build process it shows build errors. I tried VS 2015, maybe there it just a question of a wrong version?

[![screenshot](https://i.stack.imgur.com/Q6qXv.png)](https://i.stack.imgur.com/Q6qXv.png)

Answer: 
No. They are completely different.

`test in [1,2,3]` checks if there is a property **named** `2` in the object. There is, it has the value `3`.

`[1,2,3].indexOf(test)` gets the first property with the **value** `2` (which is in the property named `1`)

> 
> suggest that you can't do in on an array, only on an object
> 
> 
> 

Arrays are objects. (A subclass if we want to use classical OO terminally, which doesn't really fit for a prototypal language like JS, but it gets the point across). 

The array `[1, 2, 3]` is *like* an object `{ "0": 1, "1": 2, "2": 3 }` (but inherits a bunch of other properties from the Array constructor).
As per [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in),

> 
> The in operator returns true if the specified property is in the specified object.
> 
> 
> 

`in` will check for keys. Its similar to `Object.keys(array).indexOf(test)`

```js
var a1 = [1,2,3];
var a2 = ['a', 'b', 'c']
var test = 2;

console.log(test in a1)
console.log(test in a2)

// Ideal way

//ES5
console.log(a1.indexOf(test)>-1)
console.log(a2.indexOf(test)>-1)

//ES6
console.log(a1.includes(test))
console.log(a2.includes(test))
```