편집 기록

편집 기록
  • 프로필 편집요청빌런님의 편집
    날짜2020.02.05

    자바스크립트 if-else 질문


    이미지

    수치에 따른 사이즈 출력문입니다만. M이 출력되야하는데 어째서 S가 출력되는지 모르겠습니다 ㅠㅠ

    var shirtWidth = 20;
    var shirtLength = 29;
    var shirtSleeve = 8.38;
    
    if((18 <= shirtWidth < 20) && (28 <= shirtLength < 29) && (8.13 <=shirtSleeve < 8.38) ){
        console.log("S");
    } else if((20 <= shirtWidth <22) && (29 <= shirtLength <30) && (8.38 <= shirtSleeve < 8.63)){
        console.log("M");
    } else if((22 <= shirtWidth <24) && (30 <= shirtLength <31) && (8.63 <= shirtSleeve < 8.88)){
        console.log("L");
    } else if((24 <= shirtWidth <26) && (31 <= shirtLength <32) && (8.88 <= shirtSleeve < 9.63)){
        console.log("XL");
    } else if((26 <= shirtWidth <28) && (32 <= shirtLength <33) && (9.63 <= shirtSleeve < 10.13)){
        console.log("2XL");
    } else if((shirtWidth >=28) && (shirtLength >=34) && (shirtSleeve >= 10.13)){
        console.log("3XL");
    }else{
        console.log("N/A");
    }
    
  • 프로필 알 수 없는 사용자님의 편집
    날짜2020.02.05

    자바스크립트 if-else 질문


    이미지

    수치에 따른 사이즈 출력문입니다만. M이 출력되야하는데 어째서 S가 출력되는지 모르겠습니다 ㅠㅠ

    var shirtWidth = 20;
    var shirtLength = 29;
    var shirtSleeve = 8.38;
    
    if((18 <= shirtWidth < 20) && (28 <= shirtLength < 29) && (8.13 <=shirtSleeve < 8.38) ){
        console.log("S");
    } else if((20 <= shirtWidth <22) && (29 <= shirtLength <30) && (8.38 <= shirtSleeve < 8.63)){
        conlose.log("M");
    } else if((22 <= shirtWidth <24) && (30 <= shirtLength <31) && (8.63 <= shirtSleeve < 8.88)){
        conlose.log("L");
    } else if((24 <= shirtWidth <26) && (31 <= shirtLength <32) && (8.88 <= shirtSleeve < 9.63)){
        conlose.log("XL");
    } else if((26 <= shirtWidth <28) && (32 <= shirtLength <33) && (9.63 <= shirtSleeve < 10.13)){
        conlose.log("2XL");
    } else if((shirtWidth >=28) && (shirtLength >=34) && (shirtSleeve >= 10.13)){
        conlose.log("3XL");
    }else{console.log("N/A");
    }