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

101
Vistas
Cannot read properties of undefined (reading 'toString')

I'm currently trying to parse anonymous functions and am currently getting the error as per the title. I've tested a few things, and the core math works, but there's an issue with parsing the information. Any help is appreciated.

In this instance, manaCost = 10 and manaLevel = 0

if(manaLevel>=1){
manaCost = increase(5,manaCost,1.17,manaLevel);
} else {
manaCost = increase(5,manaCost,1.17,1);
}
function increase(n,b,r,k){
    b * (Math.pow(r,k)*((Math.pow(r,n)-1)/(r-1)));
}

The core math of

manaCost * (Math.pow(1.17,1)*((Math.pow(1.17,5)-1)/(1.17-1)))

functions.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to return a value in your functions if you want to assign something to the return value of the function. Otherwise it returns undefined.

function increase(n,b,r,k){
    return b * (Math.pow(r,k)*((Math.pow(r,n)-1)/(r-1)));
}
about 4 years ago · Juan Pablo Isaza Denunciar
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