added heading the the javascript as well as stated the math problem.