Welcome to Bucaro TecHelp!

Bucaro TecHelp
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Victims of Sandy Hook

Stop the Slaughter of Innocents. Congress is bought and paid for by gun lunatics and gun promotion groups. If you want to live in a safe America, help buy Congress back for America. Send a donation to Mayors Against Illegal Guns, 909 Third Avenue, 15th Floor New York, NY 10022

Java Script Math.tan Method

Tangent is a trigonometric function. Based on a right triangle. It's the ratio of the length of the opposite side to the length of the adjacent side.

Tangent A = opposite/adjacent

Identifying the sides of a right triangle

In identifying the sides of a right triangle, the side next to the angle for which we are using the trigonometric function is called the adjacent side. The side opposite that angle is called the opposite side.

If you know an angle and the length of the side adjacent to the angle, you can use the tangent of the angle to calculate the length of the opposite side.

length of opposite = length of adjacent * tangent of angle


angle = 35 degrees
adjacent side = 10

Java Script Using Math.tan Method

<script type="text/javascript">

var angle = 35;
var adjacent = 10;

var opposite = adjacent * Math.tan(35 * Math.PI/180);



The code shown above uses the Java Script Math.tan method. The Math.tan method requires the angle passed to it to be in radians. A radian is the angle of an arc created by wrapping the radius of a circle around its circumference. It sounds like a weard unit, by by coincidence there are 2 PI radians in a complete circle. This makes this much easier in fields like calculus. To convert degrees to radians, multiply by PI/180.

The code shown above also uses the Number objects .toFixed(n) method. This method converts a value to a number with n digits to the right of the decimal point.

More Java Script Code:
• Java Script Trigonometric Methods
• Include a Quote Character in a String
• JavaScript .big and .small to Change Text Size
• Compare Two Strings
• Find a Character or a Substring Within a String
• Window onload Event
• The break Statement
• Java Script Data Types
• Accessing Web Page Elements
• Java Script prompt Message Box

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro

Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2017 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268