Hello Friends Today, through this tutorial, I will tell you How to Write Program Antilog calculator using JavaScript with HTML. You can create a simple antilog calculator using JavaScript. The antilogarithm, or inverse logarithm, is the opposite operation of taking a logarithm. Here’s a basic implementation of an antilog calculator:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Antilog Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
margin: 50px auto;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<h2>Antilog Calculator</h2>
<label for="logValue">Enter Logarithm Value: </label>
<input type="number" id="logValue" step="any">
<button onclick="calculateAntilog()">Calculate</button>
<p id="result"></p>
</div>
<script>
function calculateAntilog() {
const logValue = parseFloat(document.getElementById('logValue').value);
const antilogValue = Math.pow(10, logValue);
document.getElementById('result').innerText = `Antilog(${logValue}) = ${antilogValue}`;
}
</script>
</body>
</html>
In this code:
1. An input field allows users to enter the logarithm value.
2. When the user clicks the “Calculate” button, the `calculateAntilog()` function is triggered.
3. Inside this function, it retrieves the logarithm value entered by the user, converts it to a floating-point number using `parseFloat()`, and then calculates the antilogarithm using `Math.pow()` function, where the base is 10 (common logarithm).
4. The result is displayed below the input field.