Advertisement
vladovip

JS - Triangle Area by its 3 sides

Dec 31st, 2021
1,542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function triangleArea(sideA, sideB, sideC) {
  2.  
  3.     let semiPerimeter = (sideA + sideB + sideC) / 2;
  4.     let areaOfTriangle = Math.sqrt(semiPerimeter * (semiPerimeter - sideA) * (semiPerimeter - sideB) * (semiPerimeter - sideC));
  5.     console.log(areaOfTriangle);
  6.  
  7. }
  8. triangleArea(2, 3.5, 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement