Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!