Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to prevent double names in an array? 1

Status
Not open for further replies.

coolrunnings

Programmer
Mar 27, 2001
2
NL
This script displays and sorts the installed plugins. However, I'm unable to remove duplicate names. Can anyone help?

Thanks in advance!

<script language=&quot;JavaScript&quot;>
if (navigator.plugins.length)
{
var num_of_plugins = navigator.plugins.length;
if (num_of_plugins > 0)
{
var c = new Array();
for (var i=0; i < num_of_plugins; i++)
{
c.push(navigator.plugins.name);
}
}
c.sort();
var y = c.length;
print(y);
for (var z=0; z<y;z++)
{
print(c[z]);
}
}
else
{
document.write(&quot;<B>No Plug-ins found!</B>&quot;);
}
//--></script>
 
there is no way if you want to use the sort function - even if you redefine the comparator
the only way to do so in jscript is doing this &quot;by hand&quot; (see the thread where you posted the same code ;-))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top