I have a script that displays a dropdown in a select box. The current script I am using is as follows:
jQuery.each( dslr, function( index, dslrgp) {
var aslrp= dslrgp.aslrp;
jQuery.each( aslrp, function(index2, pslrp) {
var found = 0;
jQuery.each( dropdown, function(index3, dditem) {
if (dditem.countryname == pslrp.countryname)
{
foundit = 1;
}
});
if (foundit == 0)
dropdown.push(pslrp);
});
});
How can I convert this to pure JavaScript? When I try the following:
dslr.forEach(function( index, dslrgp) {
var aslrp= dslrgp.aslrp;
aslrp.forEach(function(index2, pslrp) {
var found = 0;
dropdown.forEach(function(index3, dditem) {
if (dditem.countryname == pslrp.countryname)
{
foundit = 1;
}
});
if (foundit == 0)
dropdown.push(pslrp);
});
});
it does not work.