I try to share knowledge on how to implement basic math formulas using javascript. I will try with the easiest case, namely by using the formula for the area of a triangle.
Formula
The basic formula for the area of a triangle is 1/2 x base x height
Source Code
1. var base = 12;
2. var height = 15;
3. area = 0.5*(base*height);
4. console.log(area)//--> 90
Discussion Of Code Results
The code above consists of 1/2 triangle, base, height and area. each has a value, except for area, because it asks for the area of the triangle.
The base of the triangle has a value of 12 and the height of the triangle is 15, to calculate this simply enter the area of 0.5 and multiply it by the base and height of the triangle.
Okay maybe that's all I have taught, if the article I made has an error, I'm sorry and if there is input I am very happy to receive it.
Top comments (0)