Hi
I want to sort an array by non unique Values.
i have array named xo
for example with values:
xo[1]="n";
xo[2]="n";
xo[3]="n";
xo[4]="n";
xo[5]="u";
xo[6]="u";
And i need to do something like this:
newarr[4]="n";
newarr[2]="u";
document.write( "the mostly found string is:"+the Biggest value Of newarr key);
I try to do something like this, but it didnt work....
k=xo.length;
p=new Array();
xyz=new Array();
for (i=0; i<k; i++) {
xyz[i]= xo[i];
for (j=0; j<k; j++) {
if (j!=i) {
if (xo[j] == xyz[i]) {
if(p[xyz[i]]==undefined){
p[xyz[i]]=1;}
else{p[xyz[i]]+=1;}
d.write(xyz[i]+"---"+i+"---"+p[xyz[i]]+"<br>");
}
}
}
}
Sorry for my bad english:P:D
I want to sort an array by non unique Values.
i have array named xo
for example with values:
xo[1]="n";
xo[2]="n";
xo[3]="n";
xo[4]="n";
xo[5]="u";
xo[6]="u";
And i need to do something like this:
newarr[4]="n";
newarr[2]="u";
document.write( "the mostly found string is:"+the Biggest value Of newarr key);
I try to do something like this, but it didnt work....
k=xo.length;
p=new Array();
xyz=new Array();
for (i=0; i<k; i++) {
xyz[i]= xo[i];
for (j=0; j<k; j++) {
if (j!=i) {
if (xo[j] == xyz[i]) {
if(p[xyz[i]]==undefined){
p[xyz[i]]=1;}
else{p[xyz[i]]+=1;}
d.write(xyz[i]+"---"+i+"---"+p[xyz[i]]+"<br>");
}
}
}
}
Sorry for my bad english:P:D
Comment