Array.prototype.unique5 = function() { var res = [], hash = {}; for(var i=0, elem; (elem = this[i]) != null; i++)