<header>
  <h2 class="title">Math.atanh()</h2>
  <p class="description">Повертає гіперболічний арктангенс числа.</p>
</header>
<main>
  <div class="result">
    <label for="inputValue">Введіть число між -1 та 1:</label>
    <input type="number" id="inputValue" step="0.1" min="-1" max="1">
    <button onclick="calculateAtanh()">Розрахувати</button>
    <p id="output">Результат: </p>
  </div>
</main>
body {
  font-size: 16px;
  line-height: 1.5;
  font-family: monospace;
}

header {
  background-color: #f1f1f1;
  margin-bottom: 25px;
  padding: 15px;
  -webkit-box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
  -moz-box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
  box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}

header h2.title {
  padding-bottom: 15px;
  border-bottom: 1px solid #999;
}

header p.description {
  font-style: italic;
  color: #222;
}

.result {
  background-color: #f8f8f8;
  padding: 15px;
  -webkit-box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
  -moz-box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
  box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}

button {
  margin-left: 10px;
  padding: 5px 15px;
  cursor: pointer;
}

#output {
  margin-top: 20px;
  font-weight: bold;
}
function calculateAtanh() {
  const inputValue = parseFloat(document.getElementById('inputValue').value);
  if (isNaN(inputValue) || inputValue < -1 || inputValue > 1) {
    alert('Будь ласка, введіть число між -1 та 1.');
    return;
  }
  const result = Math.atanh(inputValue);
  document.getElementById('output').innerText = `Результат: ${result}`;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.