JavaScript: Duplikate aus Array entfernen

Kurzer JavaScript Code-Snippet, um Duplikate aus einem JavaScript-Array zu entfernen:

/**
 * Remove duplicates from array
 * 
 */
var removeDuplicates = function(t) {
    t.sort();

    var elems = {};
    var newArray = [];

    for (var i = 0, len = t.length; i < len; i++)  {
        elems[t[i]] = 0;
    }

    for (var elem in elems) {
        newArray.push(elem);
    }

    return newArray;
};