Arrays not unset when values are removed - or best way to get count of an array?
<p>JavaScript has some funny quirks here and there. Consider this quirk, ripped from <a href="http://dublintech.blogspot.co.uk/2012/04/javascript-language-z-cheat-sheet.html" rel="nofollow">this awesome post</a> (thanks to M. Staveley for sharing this):</p>

<pre><code>var colours = ['red', 'green', 'blue']
// is red really in the array?
console.log(colours.indexOf('red') &gt; -1);  // outputs true. 
// remove red, it's going out of fashion!
delete colours[colours.indexOf('red')];
console.log(colours.indexOf('red') &gt; -1);  // outputs false
console.log(colours.length) // length is still three, remember it's javascript!
</code></pre>

<p>Last line is what bugs me. This quirk has the best of my curiosity, what's an elegant way to get access of real count of <code>colours</code>?</p>
