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

152
Visualizações
Confusion over else...if vs regular if

I am a brand new programming hobbyist. I decided to start with JavaScript because I am interested in Web Development. Working through some classes I have encountered something that really confuses me. What is the purpose of "else...if" when it seems that multiple "ifs" do the same thing. I've really tried to find this answer before I posted here. I've worked out several tests in the Chrome console. Thank You in advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It makes a difference when multiple conditions might hold. For example:

if (x) { do thing 1 }
if (y) { do thing 2 }

will do both thing 1 and thing 2 if x and y are both true. But

if (x) { do thing 1 }
else if (y) { do thing 2 }

will do only thing 1 if x is true, even if y is also true. It will do y only if y is true and x is false.

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