diff --git a/main.js b/main.js index 6fb0fe5..3774a0c 100644 --- a/main.js +++ b/main.js @@ -13,7 +13,7 @@ const operators = ["+", "-", "x", "รท"]; function handleKeyPress (e) { const key = e.target.dataset.key; - const lastChar = operation[operation.length - 1]; + const lastChar = operation.pop(); use build in functions if (key === "=") { return;