JavaScript has some funny quirks here and there. Consider this quirk, ripped from this awesome post (thanks to M. Staveley for sharing this):
var colours = ['red', 'green', 'blue']
// is red really in the array?
console.log(colours.indexOf('red') > -1); // outputs true.
// remove red, it's going out of fashion!
delete colours[colours.indexOf('red')];
console.log(colours.indexOf('red') > -1); // outputs false
console.log(colours.length) // length is still three, remember it's javascript!
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 colours
?