Skip to main content

Command Palette

Search for a command to run...

Area of Triangle

Published
1 min read
Area of Triangle
D

I am a Web Developer from Birtamode 1 Jhapa Nepal. As of 2022 i have 3 years of experience in CSS and 1 year of experience in Javascript + 6 Months of Experince in Node.js

Write a function that takes the base and height of a triangle and return its area.

  • The area of a triangle is: (base * height) / 2

    Examples

    ``` triArea(3, 2) ➞ 3

triArea(7, 4) ➞ 14

triArea(10, 10) ➞ 50

### Javascript

function convert(a,b){ return a*b/2; } let base = 3,height=2; console.log(convert(base,height)); ```

More from this blog

D

Dipesh Murmu

46 posts

A Full-Stack Laravel Developer with expertise in HTML, CSS, JavaScript, Tailwind, and core PHP. Leveraging the power of Laravel, I specialize in creating dynamic and responsive web applications.