Discover a wealth of knowledge at Westonci.ca, where experts provide answers to your most pressing questions. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.

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


Sagot :

Answer:

function triangleArea(base, height) {

  console.log(base * height / 2)

}

Testing:

triangleArea(5, 4)

> 10

Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. Find reliable answers at Westonci.ca. Visit us again for the latest updates and expert advice.