Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

823
Visualizações
can we validate multiple functions inside if condition with AND operator using java script is there any other way to check multiple functions true?

I have added these functions and need return something based which function is returning true but it is not working.

//this is function1/
function A() {
  return true;
}

function B() {
  return true;
}

function C() {
  if ({
      {
        var -customJS - page_type_lookup
      }
    } === 'product') {
    var config = document.querySelector('#product-content > div.product-variations.clearfix > div.attribute.variant-dropdown > div.attribute-values-section > div.label.va-navSectionalOrientation').innerText;
    if (config.includes('Sectional Orientation')) {
      return true;
    } else {
      return false;
    }
  }
}
if (A() === true && B() === true && C() === true) {
  return 'A+ Content, RTA Product, Sectional Configurator';
} else if (A() === true && B() === true) {
  return 'A+ Content, RTA Product';

} else if (B() === true && C() === true) {
  return 'RTA Product, Sectional Configurator';
} else if (C() === true && A() === true) {
  return 'Sectional Configurator, A+ Content';
} else if (A() === true) {
  return 'A+ Content';
} else if (B() === true) {
  return 'RTA Product';
} else {
  return 'Sectional Configurator';
}
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you have more than one function and a data set which reflects the wanted value of each flag, you could take an array for the functions retun values and another for the strings which are filterd and joined for the result.

const
    flags = [a(), b(), c()],
    result = ['A+ Content', 'RTA Product', 'Sectional Configurator']
        .filter((_, i) => flags[i])
        .join(', ');
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda