dragonkeeper
Technical User
the following code is not working. it appears the statement that evaluates array elements is not working as i intended.
But if i hard code a value in place of one the elements the code works as intended.What am i missing? code is pasted below.
Array.prototype.unique = function()
{
var i;
var j;
var b=new Array();
main:for(i=0;i<this.length;i++)
{
for (j=0;j<b.length;j++)
{
if(this==b[j])
{
continue main;
}
}
b[b.length]=this;
}
return b;
}
But if i hard code a value in place of one the elements the code works as intended.What am i missing? code is pasted below.
Array.prototype.unique = function()
{
var i;
var j;
var b=new Array();
main:for(i=0;i<this.length;i++)
{
for (j=0;j<b.length;j++)
{
if(this==b[j])
{
continue main;
}
}
b[b.length]=this;
}
return b;
}