From f3a10eadd5230bf1c4d76e8823b88c24f8632eaa Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 28 Nov 2023 01:46:44 +0200 Subject: [PATCH] Trigger concatenation on NaN current value --- public/scripts/variables.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/scripts/variables.js b/public/scripts/variables.js index 9d1a17f70..7c334dddc 100644 --- a/public/scripts/variables.js +++ b/public/scripts/variables.js @@ -37,7 +37,7 @@ function addLocalVariable(name, value) { const currentValue = getLocalVariable(name) || 0; const increment = Number(value); - if (isNaN(increment)) { + if (isNaN(increment) || isNaN(Number(currentValue))) { const stringValue = String(currentValue || '') + value; setLocalVariable(name, stringValue); return stringValue; @@ -57,7 +57,7 @@ function addGlobalVariable(name, value) { const currentValue = getGlobalVariable(name) || 0; const increment = Number(value); - if (isNaN(increment)) { + if (isNaN(increment)|| isNaN(Number(currentValue))) { const stringValue = String(currentValue || '') + value; setGlobalVariable(name, stringValue); return stringValue;