var huruf:Array = new Array("b","a","b","a","c","c","d","b","b","b");
for (var k:int= 0; k < 10; k++)
{ removeYangSama(huruf);
}
trace(huruf);
function removeYangSama(sama:Array):void
{
var i:int;
var j:int;
for (i = 0; i < sama.length - 1; i++)
{
for (j = i + 1; j < sama.length; j++)
{
if (sama[i] == sama[j])
{
sama.splice(j, 1);
}
}
}
}
alternatif lain
var huruf:Array = ["b","a","b","a","c","c","d","b","b","b"];
trace(huruf.filter(function(e, i, huruf) {
return huruf.indexOf(e) == i;
}, this));
facebook
twitter
google+
fb share