From 51a8a386d958846585288751ee6c85e226f9c7e2 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Wed, 19 Mar 2025 20:37:57 +0100 Subject: [PATCH] Improve it --- src/calculator/index.html | 2 +- src/calculator/script.js | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/calculator/index.html b/src/calculator/index.html index 0f330c2..95860c6 100644 --- a/src/calculator/index.html +++ b/src/calculator/index.html @@ -13,6 +13,6 @@ } - +

Port:

\ No newline at end of file diff --git a/src/calculator/script.js b/src/calculator/script.js index 3594755..b31e76c 100644 --- a/src/calculator/script.js +++ b/src/calculator/script.js @@ -1,11 +1,7 @@ function onAsnInput(inputElement) { + inputElement.value = inputElement.value.replace(/(?![0-9])./gmi,''); + let portElement = document.getElementById('result'); - - if (inputElement.value == '') { - portElement.innerText = ''; - return; - } - portElement.innerText = calculate(inputElement.value); }