Write a JavaScript to design a simple calculator to perform the following operations: sum, product, difference and quotient
<! DOCTYPE html>
<html>
<head>
<title>Factorial Calculator</title>
<script>
// Function to compute the factorial of a number
function calculateFactorial() {
var num = parseInt(document.getElementById("number").value);
var factorial = 1;
if (num >= 0) {
for (var i = 1; i <= num; i++) {
factorial *= i;
}
alert("Factorial of " + num + " is: " + factorial);
} else {
alert("Please enter a non-negative number!");
}
}
</script>
</head>
<body>
<h1 >Factorial Calculator</h1>
<label for="number">Enter a number:</label>
<input type="number" id="number"> <br>
<button onclick="calculateFactorial()">Calculate Factorial</button>
</body>
</html>
Save the code in an HTML file, and you can open it in a web browser to see your biodata webpage. Remember to include your photo file (e.g., your_photo.jpg) in the same directory as the HTML file or provide the correct file path in the src attribute of the img tag.