Created
November 16, 2022 19:03
-
-
Save KonradLinkowski/5eaf0fde26a4ee961a3ed9774de5f186 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calcula(op) { | |
const operations = { | |
'+': (a, b) => a + b, | |
'-': (a, b) => a - b, | |
'*': (a, b) => a * b, | |
'/': (a, b) => a / b, | |
} | |
const operation = operations[op] | |
const n1 = document.getElementById("n1").value; | |
const n2 = document.getElementById("n2").value; | |
document.getElementById('ex13').value = operation(n1, n2) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment