Number Variables Error: NaN

Oct 31, 2023

Hello Heroes,

I'm working on a Storyline project that requires me to complete some math in Javascript. This requires very small numbers (decimals near 0.0004) and because Storyline rounds number variables to two decimal points, i'm trying to use Javascript. Ultimately, I am trying to calculate the monthly payment on a home.

In the attached example, the set variables are pulled into JS with the second button and 2 instances of JS math are performed. 

You'll see the code is able to calculate the Principal, but the calculation for Monthly Payment always returns NaN.

I've tested this code in a javascript playground and all of the math checks out. What are some reasons I am returning NaN?

2 Replies