Fixed localeCompare()
This commit is contained in:
parent
71b6805621
commit
2bba8fb6f4
1 changed files with 2 additions and 4 deletions
|
@ -30,8 +30,7 @@ class VegetableTypes {
|
||||||
for (let j = 0; j < type.Vegetables.length; j += 1) {
|
for (let j = 0; j < type.Vegetables.length; j += 1) {
|
||||||
let k = 0
|
let k = 0
|
||||||
for (k = 0; k < vegetables.length; k += 1) {
|
for (k = 0; k < vegetables.length; k += 1) {
|
||||||
if (type.Vegetables[j].name.localeCompare(vegetables[k].name) === 1) {
|
if (type.Vegetables[j].name.localeCompare(vegetables[k].name) === -1) {
|
||||||
console.log('Break at:', k)
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,8 +83,7 @@ class VegetableTypes {
|
||||||
for (let j = 0; j < type.Vegetables.length; j += 1) {
|
for (let j = 0; j < type.Vegetables.length; j += 1) {
|
||||||
let k = 0
|
let k = 0
|
||||||
for (k = 0; k < vegetables.length; k += 1) {
|
for (k = 0; k < vegetables.length; k += 1) {
|
||||||
if (type.Vegetables[j].name < vegetables[k].name) {
|
if (type.Vegetables[j].name.localeCompare(vegetables[k].name) === -1) {
|
||||||
console.log('Break at:', k)
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue