Tengo html href y estoy vinculado a una función en el archivo js. Desde el html cuando el usuario hizo clic, validará el perfil del usuario por país. Si el perfil del usuario = TH y SG, abrirá una url, de lo contrario, abrirá b url. Por favor, ayúdame. no se que le pasa a mi codigo
/* API Completion */ api.done(function (a, c, d) { console.log(ad); var countryCode = ""; function checkCountry(upp) { return upp.Key === "CountryCode"; } var arrUPP = adUserProfileProperties.results.filter(checkCountry); //btn.addEventListener("click", travel); $(document).ready(function() { //$('ul.nav li').click(function() if (arrUPP.length > 0 && arrUPP[0].Value) { countryCode = arrUPP[0].Value; } else if (countryCode == "TH" && countryCode == "SG") { window.location.href = 'https://....a url'; } else { window.location.href = 'https://....b url'; return; } }); //} }); api.fail(function (a, b, c) { var errorMessage = []; errorMessage.push(errorMessage); errorMessage.push("Error: " + a.responseJSON.error.message.value); alert(errorMessage.join("\n")); }); <li class="main"> <a class="travel" href="javascript:travel();" target="blank"> <i class="icon-travel"></i> <span>Country</span> </a> </li>Esto nunca será cierto countryCode == "TH" && countryCode == "SG" . Espera que un valor sea tanto "TH" como "SG". Probablemente quisiste usar || .