Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

85
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!