array_unique javascript snippet

function array_unique(a)
{
    return a.reduce(function(u, e)
    {
        if(!(e in u))
            u.push(e);

        return u;
    }, []);
}

This entry was posted on Monday, February 23rd, 2009 at 4:07 pm and is filed under javascript, programming. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply