Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

165
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda