👤

7.2.4 Area of Triangle HELP PLEASE!! (JAVA SCRIPT) I WILL WAIT FOR THE SOLUTION.

Write a function that computes the area of a triangle given its base and height.

The formula for an area of a triangle is:

AREA = 1/2 * BASE * HEIGHT
For example, if the base was 5 and the height was 4, the area would be 10.

triangleArea(5, 4); // should print 10
Your function must be named triangleArea

Answer :

Answer:

function triangleArea(base, height) {

  console.log(base * height / 2)

}

Testing:

triangleArea(5, 4)

> 10