Check if value exists in JavaScript object
<p>How would I check in my array of objects, if a specific item exists (in my case MachineId with id 2)?</p>

<pre><code>[{"MachineID":"1","SiteID":"20"},{"MachineID":"2","SiteID":"20"},{"MachineID":"3","SiteID":"20"},{"MachineID":"4","SiteID":"20"}]
</code></pre>

<p>I tried this:</p>

<pre><code>if (index instanceof machineIds.MachineID) {
    alert('value is Array!');
} else {
    alert('Not an array');
}
</code></pre>
