Skip to content

Instantly share code, notes, and snippets.

@pyfisch
Created March 21, 2020 12:32
Show Gist options
  • Save pyfisch/4616c7dbbc91c97af4d94dfcc629b278 to your computer and use it in GitHub Desktop.
Save pyfisch/4616c7dbbc91c97af4d94dfcc629b278 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/yicukaqoke
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<ul>
<li>Aktuelle Fallzahl: <input id="m" type="number">
<li>Frühere Fallzahl: <input id="n" type="number">
<li>Abstand (Tage) <input id="x" type="number">
</ul>
<input id="submit" type="button" value="Berechnen">
<p>Die Zahl der Fälle verdoppelt sich alle <strong id="y">...</strong> Tage.
<script id="jsbin-javascript">
function formula(m, n, x) {
const log = Math.log10
return (x * log(2) / (log(m) - log(n)))
}
const button = document.getElementById("submit");
button.onclick = (e) => {
let m = Number.parseInt(document.getElementById("m").value)
let n = Number.parseInt(document.getElementById("n").value)
let x = Number.parseInt(document.getElementById("x").value)
let y = document.getElementById("y")
y.textContent = formula(m, n, x).toFixed(2)
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">function formula(m, n, x) {
const log = Math.log10
return (x * log(2) / (log(m) - log(n)))
}
const button = document.getElementById("submit");
button.onclick = (e) => {
let m = Number.parseInt(document.getElementById("m").value)
let n = Number.parseInt(document.getElementById("n").value)
let x = Number.parseInt(document.getElementById("x").value)
let y = document.getElementById("y")
y.textContent = formula(m, n, x).toFixed(2)
}
</script></body>
</html>
function formula(m, n, x) {
const log = Math.log10
return (x * log(2) / (log(m) - log(n)))
}
const button = document.getElementById("submit");
button.onclick = (e) => {
let m = Number.parseInt(document.getElementById("m").value)
let n = Number.parseInt(document.getElementById("n").value)
let x = Number.parseInt(document.getElementById("x").value)
let y = document.getElementById("y")
y.textContent = formula(m, n, x).toFixed(2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment