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

97
Visualizações
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 Respostas
Responde à pergunta

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 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