조건문
조건문(Conditional Statement)
주어진 조건에 따라서 에플리케이션을 다르게 동작하도록 하는 것으로, Boolean(true/false)은 조건문에서 핵심적인 역할을 담당
1. if 조건문
if (조건){
실행될 코드;
}if(true){
alert(1);
alert(2);
alert(3);
alert(4);
}
alert(5); // 1 , 2 , 3 , 4 , 5if(false){
alert(1);
alert(2);
alert(3);
alert(4);
}
alert(5); // 51-1. if ~ else
1-2. else if
2. 중첩 if 조건문
Last updated
Was this helpful?