![]() |
Help with Calculator
I currently am making a calculator (to learn javascript better)
it's a karvonen heart rate calculator which calculates what your target heart rate BPM should be for a percentage workout, the formula is as follows: (maximum heart rate = maximum achievable heart rate) (minimum heart rate = heart rate measured just after waking up) maximum heart rate - minimum heart rate * workout percentage + minimum heart rate = target bpm ok, now i can get the formula kinda working.. the poblem i have is with this code: targetHeartRateLow=Math.floor((maxHeartRate-minHeartRate)*percentZoneMin/100)+minHeartRate; instead of adding minHeartRate it joins it like two strings like 4499 instead of showing 143 (44+99). Below is the code i'm using :
function calc(form){ |
look into using the parseInt function.
(http://www.w3schools.com/jsref/jsref_parseInt.asp) |
it's been a while since i last posted (been busy) but i got it in the end, here is the code i used.
:
Thanks for the help. |
I know it's over, but you could also use the Number() function as well as the parseInt() function. ;)
It brings back a float / double. |
| All times are GMT -5. The time now is 12:26 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC