Remove Duplicates from an Array AS3

I recently needed function that would remove duplicate values from an array. After looking around online and modifying what I found to fit my needs I came up with the following:

var arr:Array = ["a", "b", "c", "a", "d", "a", "a"];

removeDuplicates(arr);

trace(arr);

function removeDuplicates(target:Array):void
{
	for(var i:uint=target.length; i>0; i--)
	{
		if(target.indexOf(target[i-1]) != i-1)
		{
			target.splice(i-1, 1);
		}
	}
}

If you are searching for a way to do this, I hope this helps!

Let Me Explain

So if you’ve read the previous posts on my blog you might be wondering what’s going on. Before abandoning it, please know that I’m still going to blog about cool programming and graphic design stuff, but now and then I’m going to add some cool quotes and yummy recipes. After all any good programmer or graphic designer needs to hear some awesome quotes and definitely needs to eat some delicious treats. Oh and to make up for the treats I might every now and again throw in one about nutrition or exercise.