From 2bba8fb6f430d253b9518714ee87537261ebfe4d Mon Sep 17 00:00:00 2001 From: dbroqua Date: Thu, 11 Apr 2019 13:40:52 +0200 Subject: [PATCH] Fixed localeCompare() --- middleware/VegetableTypes.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/middleware/VegetableTypes.js b/middleware/VegetableTypes.js index b1e5963..908e6ce 100644 --- a/middleware/VegetableTypes.js +++ b/middleware/VegetableTypes.js @@ -30,8 +30,7 @@ class VegetableTypes { for (let j = 0; j < type.Vegetables.length; j += 1) { let k = 0 for (k = 0; k < vegetables.length; k += 1) { - if (type.Vegetables[j].name.localeCompare(vegetables[k].name) === 1) { - console.log('Break at:', k) + if (type.Vegetables[j].name.localeCompare(vegetables[k].name) === -1) { break } } @@ -84,8 +83,7 @@ class VegetableTypes { for (let j = 0; j < type.Vegetables.length; j += 1) { let k = 0 for (k = 0; k < vegetables.length; k += 1) { - if (type.Vegetables[j].name < vegetables[k].name) { - console.log('Break at:', k) + if (type.Vegetables[j].name.localeCompare(vegetables[k].name) === -1) { break } }