From 070b39a5174fc0259e11d1d21dcf84cda39bb082 Mon Sep 17 00:00:00 2001 From: Luciano Ayres Date: Sat, 5 Nov 2022 18:49:30 -0300 Subject: [PATCH] fix: prevent type error on the arrow button Fixes a type error bug when the user clicks on the arrow button after calculating the result of a previous operation. --- static/calculator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/calculator.js b/static/calculator.js index efc7afde..ce3035ca 100644 --- a/static/calculator.js +++ b/static/calculator.js @@ -70,7 +70,8 @@ function handleSymbol(value) { if (buffer.length === 1) { buffer = "0"; } else { - buffer = buffer.substring(0, buffer.length - 1); + const bufferString = buffer.toString() + buffer = bufferString.substring(0, bufferString.length - 1); } break; case "+":