From 3929df31fb1511a91ebc74f70f5f183ce784ca6d Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Mon, 17 Feb 2020 01:46:40 -0500 Subject: [PATCH] why won't return work --- src/js/itemAvailability.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/itemAvailability.js b/src/js/itemAvailability.js index 14f4f64e394..95a4924a237 100644 --- a/src/js/itemAvailability.js +++ b/src/js/itemAvailability.js @@ -205,15 +205,19 @@ window.isClothingAccessible = function(string) { return true; } - let test = setup.clothes.forEach(item => { + let success = 0; + + setup.clothes.forEach(item => { if (item.value === string) { if (!(item.hasOwnProperty("unlock")) && !(item.hasOwnProperty("fs"))) { console.log(`${string} is free for everyone!`); + success = 1; return true; } if (item.hasOwnProperty("fs")) { if (V.arcologies[0][item.fs] > 0) { console.log(`${string} is in FS!`); + success = 1; return true; } } @@ -222,9 +226,11 @@ window.isClothingAccessible = function(string) { for (let key in keys) { if (key === "continent" && V.continent === item.unlock[key]) { console.log(`${string} is in continent!`); + success = 1; return true; } else if (V[key] > 0 ) { console.log(`${string} ${key} is true for us!`); + success = 1; return true; } } @@ -234,8 +240,7 @@ window.isClothingAccessible = function(string) { } return false; }); - console.log(test); - if (test === true) { + if (success === 1) { return true; } }; -- GitLab