Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Ossian MacDonald2,175 Points
Trouble with Math.pow
I am having trouble with the math.pow function. I am trying to replicate this formula:
monthlyPayment = principal * ( monthlyInterest/ (1 - (1 + monthlyInterest) ^ -numberOfMonths))
But, the number that I get from this calculation is far too small. So, I think that I am not writing the formula correctly in JS. I would really appreciate you taking a look at the relevant code:
Thanks so much!
James Barnett39,199 Points
When using a function you need parentheses around the arguments
Math.pow(argX, argY). So in your case that would be
Also you forgot to end a few lines with semi-colons.
ctrl+shift+7 to show JSHint messages and
ctrl+shift+8 to hide JSHint messages.