Last active
June 28, 2018 03:48
-
-
Save sayham-sjb/3a1b3598cfd563688ac85f0e9c0f79c6 to your computer and use it in GitHub Desktop.
DogYearCalculator #js #VS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function HumanDogYears(form) { | |
var HumanYears = form.inYears.value; | |
if (HumanYears >= 21) { | |
dy = (HumanYears - 21) / 4 + 2; | |
} else { | |
dy = HumanYears / 10.5; | |
} | |
var hdy = 0; | |
if (HumanYears >= 2) { | |
hdy = 21 + ((HumanYears - 2) * 4); | |
} else { | |
hdy = HumanYears * 10.5; | |
} | |
form.DogYears.value = Math.round(dy * 100) / 100; | |
form.HumanYears.value = Math.round(hdy * 100) / 100; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment