The following function accepts a value in degrees, converts it to radians and returns the tangent.
function getTanDeg(deg) { var rad = deg * Math.PI/180; return Math.tan(rad); } console.log(getTanDeg(30));//from w w w . j a v a2 s. c o m