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

155
Visualizações
Started learning JS a weak ago, I'm getting this SyntaxError: Unexpected keyword 'else'

To start, I'm well aware that there have been many similar questions, trust me, I wouldn't have gone through the effort of making an account if I hadn't check those first. I've been coding on Python for around 3 years so I'm no stranger to programming logic, here's the code:

digest (FoodItem) {
        uk = upkeep();
        x = this.fullness + FoodItem.filling;
        y = this.Capacity + FoodItem.filling * 0.5;
        if (x>y) {
            return "Can't eat this"
        };
        else {
            this.fullness = x;
            z = 1;
            if (this.fullness > this.Saturation) {
                z = 1 + (this.fullness - this.Saturation)*0.1;
                z = z.toFixed(1);
            };
            if (this.quota < uk) {
                this.quota = this.quota + FoodItem.mass * z;
            };
            else {
                ...;
            };  
        };      
    };

Now, I know that removing the second else doesn't solve the issue so the main problem lies with the first one, I think but as to why it's not working I have no idea.

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