Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

86
Vistas
Tengo 3 variables que devolverán valores verdaderos o falsos y necesito comparar esas 3 variables que necesito para devolver los valores que probé debajo del código

pero este código funciona solo las tres variables son verdaderas, sugiera que para otras condiciones no funciona.

Me gustaría saber cómo se ejecutan todas las condiciones siguientes.

 //this is the function// function() { if({{var - customJS - page_type_lookup}} === 'product' || {{var - aev - element click text}} === 'Quick View') { var A = document.querySelector('#pdpMain > div.product-aplus-content.clearfix > div.content-desktop > div.content-container > img').getAttribute('alt').includes('A Plus Content');// variable 1 var B = document.querySelector("#rta-badge > div.rta-assembly-content > div.rta-left-section > span").innerText.includes('Assembly required');// variable 2 var C = document.querySelector('#product-content > div.product-variations.clearfix > div.attribute.variant-dropdown > div.attribute-values-section > div.label.va-navSectionalOrientation').innerText.includes('Sectional Orientation');// variable 3 //comparison // if(A === true && B === true && C === true) { return 'A+ Content, RTA, Sectional configurator'; } else if(A === true && B === true && C !== true) { return 'A+ Content, RTA'; } else if(A === true && B !== true && C === true) { return 'A+ Content, Sectional configurator'; } else if (A !== true && B === true && C === true) { return 'RTA, Sectional configurator'; } else if(A === true && B !== true && C !== true) { return 'A+ content'; } else if(A !== true && B === true && C !== true) { return 'RTA'; } else if(A !== true && B !== true && C === true) { return 'Sectional configurator'; } else if(A !== true && B !== true && C !== true) { return; } } }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

fe:

 var arr = []; if (A) arr.push("A+ content"); if (B) arr.push("RTA"); if (C) arr.push("Sectional configurator"); return arr.join(", ");

Bien, aquí hay un ejemplo:

 function go () { var arr = []; if (document.getElementById("A").checked) arr.push("A+ Content"); if (document.getElementById("B").checked) arr.push("RTA"); if (document.getElementById("C").checked) arr.push("Sectional configurator"); document.getElementById("ret").value = arr.join(", "); }
 <input type="checkbox" id="A">variable A</input><br> <input type="checkbox" id="B">variable B</input><br> <input type="checkbox" id="C">variable C</input><br> <button onclick="javascript:go();">Go!</button><br> <textarea id="ret"></textarea>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda