From 5a719d635a387016223aeebe48a5ab19ee899052 Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Thu, 7 Dec 2023 18:27:11 +0000 Subject: [PATCH] use isArray instead of instanceof --- 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 93e5d342a..a846aaeec 100644 --- a/public/scripts/variables.js +++ b/public/scripts/variables.js @@ -111,7 +111,7 @@ function addLocalVariable(name, value) { const currentValue = getLocalVariable(name) || 0; try { const parsedValue = JSON.parse(currentValue); - if (typeof parsedValue == 'object' && parsedValue instanceof Array) { + if (Array.isArray(parsedValue)) { parsedValue.push(value); setGlobalVariable(name, JSON.stringify(parsedValue)); return parsedValue; @@ -139,7 +139,7 @@ function addGlobalVariable(name, value) { const currentValue = getGlobalVariable(name) || 0; try { const parsedValue = JSON.parse(currentValue); - if (typeof parsedValue == 'object' && parsedValue instanceof Array) { + if (Array.isArray(parsedValue)) { parsedValue.push(value); setGlobalVariable(name, JSON.stringify(parsedValue)); return parsedValue;