Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

JavaScript Area When All Sides are Known

// JavaScript program to find the area of a triangle

const side1 = parseInt(prompt('Enter side1: '));
const side2 = parseInt(prompt('Enter side2: '));
const side3 = parseInt(prompt('Enter side3: '));

// calculate the semi-perimeter
const s = (side1 + side2 + side3) / 2;

//calculate the area
const areaValue = Math.sqrt(
  s * (s - side1) * (s - side2) * (s - side3)
);

console.log(
  `The area of the triangle is ${areaValue}`
);
Comment

PREVIOUS NEXT
Code Example
Javascript :: electron write to csv 
Javascript :: show hide element with javascript stack overflow 
Javascript :: Next / Sanity SSR client fetch 
Javascript :: react antd modal with quill 
Javascript :: parseint javascript online 
Javascript :: air config file 
Javascript :: Assigning A Property The Return Value Of A Function In Class 
Javascript :: node-red function string to int 
Javascript :: what does the symbol function do in javascript 
Javascript :: useDapp connect metamask example 
Javascript :: var logNums = function(num) {}; 
Javascript :: JavaScript HTMLCollection Object 
Javascript :: pass data between router components 
Javascript :: express dynamic api template 
Javascript :: Backbone View El 
Javascript :: verify if user input is equal to javascript 
Javascript :: Different Pages For Different Routes In Backbone 
Javascript :: Top Tips for Vue 3 Development 
Javascript :: run javascript after rendering 
Javascript :: if statement js 
Javascript :: electron npm start not working 
Javascript :: for loop javascript array of objects 
Javascript :: append javascript variable to html 
Javascript :: js duplicate 
Javascript :: custom hook react 
Javascript :: how to convert roman to decimal in javascript 
Javascript :: how to run react app on apache server 
Javascript :: javascript variable hoisting 
Javascript :: javascript of the object properties to a single variable 
Javascript :: JavaScript Validation API 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =