Skip to main content
2 of 2
added 196 characters in body

If I'm not mistaken Math.tan(x) does not take angles as degrees, but rather radians. If you want to supply angles as degrees, try the following code sample:

function getTanDeg(deg) {
   var rad = deg * Math.PI/180;
   return Math.tan(rad);
}

Source - Mozilla Developer Network