if (shirtWidth >= 18 && shirtWidth > 29) (shirtLength >29) && (shirtSleeve > 8.38); {
console.log("S");
} else if (shirtWidth >= 19 && shirtWidth == 22) (shirtLength == 29) && (shirtSleeve > 8.13 && shirtSleeve < 8.38); {
console.log("M");
} else if (shirtWidth >= 21 && shirtWidth == 23) (shirtLength === 30) && (shirtSleeve > 8.38 && shirtSleeve == 8.87); {
console.log("L");
} else if (shirtWidth <22 && shirtWidth == 25) (shirtLength === 31) && (shirtSleeve < 8.63 && shirtSleeve == 9.62); {
console.log("XL");
} else if (shirtWidth < 24 && shirtWidth == 29) (shirtLength === 34) && (shirtSleeve < 9.63 && shirtSleeve == 10.12); {
console.log("2XL");
} else if (shirtWidth < 26 && shirtWidth == 23) (shirtLength === 30) && (shirtSleeve < 10.13 && shirtSleeve ==12.00); {
console.log("3XL");
}
如果你不能告诉我,我对JavaScript很新。我似乎找不到这个错误的解决方案,我的其他if语句。
答案 0 :(得分:0)
改变你的代码,你做错了
if ((shirtWidth >= 18 && shirtWidth > 29) || (shirtLength >29 && shirtSleeve > 8.38) ){
console.log("S");
} else if( (shirtWidth >= 19 && shirtWidth == 22) || (shirtLength == 29 && shirtSleeve > 8.13 && shirtSleeve < 8.38)){
console.log("M");
} else if ((shirtWidth >= 21 && shirtWidth == 23) || (shirtLength === 30 && shirtSleeve > 8.38 && shirtSleeve == 8.87)){
console.log("L");
} else if ((shirtWidth <22 && shirtWidth == 25) || (shirtLength === 31 && shirtSleeve < 8.63 && shirtSleeve == 9.62)) {
console.log("XL");
} else if ((shirtWidth < 24 && shirtWidth == 29) || (shirtLength === 34 && shirtSleeve < 9.63 && shirtSleeve == 10.12)) {
console.log("2XL");
} else if((shirtWidth < 26 && shirtWidth == 23) || (shirtLength === 30 && shirtSleeve < 10.13 && shirtSleeve ==12.00)) {
console.log("3XL");
}