중첩 if문

중첩 if문은 if문 안에 if 문이 오는 구조입니다.

중첩 if 문

if(조건식1){ if(조건식2){ //실행문 } }

let useID = "pasahu13";
let usePW = "1234";

let id = prompt("아이디가 무엇입니까?");
let pw = prompt("비밀번호가 무엇입니까?");

if( useID === id){
    if( usePW === pw){
        document.write("환영합니다.");
    } else{
        document.write("비밀번호가 틀렸습니다.");
    }
} else {
    document.write("아이디를 다시 한번 확인해주세요!");
}

Last updated

Was this helpful?