<script language= "Web Effects" >
<!--
var stra= "1,2,3,4,5,6,7";
var strb= "2,0,4,6,8,9";
Need to remove 2,4,6 three elements
var str=stra+ "," +STRB;
var strarr=str.split (",");
Sort
Strarr.sort ();
var result=new array ();
var temps tutorial tr= "";
for (var i in Strarr)
{
if (Strarr[i]!= tempstr)
{
Result.push (Strarr[i]);
Tempstr=strarr[i];
}
Else
{
Continue
}
}
Alert (Result.join (","))
-->
</script>
Here's what I've been searching for on the internet.
Delete the elements in the array with duplicate values, please enlighten me if you have any good suggestions.
Code:
function Removeduplelem ()
{
var array = new Array ();
for (var i=0; i<10; i++)
{
Array.push (i+ "name");
}
Array.push ("3name");
Array.push ("5name");
Array.push ("9name");
Array.push ("3name");
Array.push ("9name");
Array.push ("9name");
for (var i=0; i<array.length; i++)
{
for (var j=i+1; j<array.length;j++)
{
if (Array[i]==array[j])
{
Array = removeelement (J,array);//delete the element of the specified subscript (in the previous article)
i=0;
Break
}
}
}
for (var i=0; i<array.length; i++)
{
Alert (Array[i]);
}
return array;
}
Method Three
<script>
var shu=array ("110846896", "110846897", "110846896");
for (Var i=0;i < shu.length;i++)
{
for (var j=i+1;j<shu.length;j++)
{
if (shu[i]==shu[j])
{
shu[i]=0;
break;
}
}
if (Shu [i]!=0)
{
document.write (shu[i] + "<br>");
}
}
</script>