Write a JavaScript program to find the area of a triangle where lengths of the three of its sides are 5, 6, 7.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="answer"></div>
base<input type="number" name="" id="base">
height<input type="number" name="" id="height">
<input type="button" value="submit" id="submit">
<script>
let submit = document.getElementById('submit');
submit.addEventListener("click", function () {
let answer = document.getElementById('answer');
let base = document.querySelector('#base').value;
let height = document.querySelector('#height').value;
// console.log(typeof(base));
// console.log(base);
let area = base * height;
// console.log(area);
answer.innerHTML= area;
});
</script>
</body>
</html>
Comments
Post a Comment