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

258
Visualizações
Why this two parts do not want to work together?

guys!

I tried to solve this kata and ran into a problem

https://www.codewars.com/kata/593b1909e68ff627c9000186/train/javascript

  function nicknameGenerator(name){
   if (name.length < 4) {
   test = "Error: Name too short";
   return test;
 } else if (name.length > 4 && name[3] != 'a' || 'e' || 'i' || 'o' || 'u') {
     return name.substr(0, 3); 
   }      else if (name.length > 4 && name[4] == 'a' || 'e' || 'i' || 'o' || 'u')  {
          return name.substr(0, 4);
         } 
   }

both 'else if' parts work great separately from each other. but in the general code only one works, what am I doing wrong? also, if you rearrange the part "Error: Name too short" to the end, then it will also not work :с

I'm just starting to learn so please be patient with me please :)

about 4 years ago · Juan Pablo Isaza
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