In JS, which is faster: Object's "in" operator or Array's indexof?
<p>I want to keep a list of strings that I will only ever check for the presence of, eg:</p>

<pre><code>corporatePlan = [
    'canDeAuthorize',
    'hasGmailSupport',
    'canShareReports',
    'canSummonKraken',
    'etc'
]
</code></pre>

<p>So, when the user tries to summon the kraken, I'll do <code>corporatePlan.indexof('canSummonKraken') != -1</code> to see if he can.</p>

<p>A coworker suggests that it would be faster to store it as an object:</p>

<pre><code>"Corporate Plan" = {
    'canDeAuthorize' : null,
    'hasGmailSupport' : null,
    'canShareReports' : null,
    'canSummonKraken' : null,
    'etc' : null
}
</code></pre>

<p>And just do something like <code>'canSummonKraken' in corporatePlan</code> to check if the plan contains that key.  This makes sense in a classic CS sense, since of course 'contains' is constant time on a map and linear on an array.  Does this check out against how arrays and objects are implemented under the hood in JS, though?</p>

<p>In our particular case, with less than 100 elements, the speed doesn't matter much.  But for a larger array, which way would be faster on access?</p>
