Notice
Recent Posts
Recent Comments
Link
초짜코딩의 잡동사니
데이터 제어하기 - 1 본문

01. if문
{
if(true){
document.write("실행되었습니다.(true)");
} else{
document.write("실해되었습니다.(false)");
}
}
결과보기
실행되었습니다.(true)
02. if문 생략
{
const num = 100;
if(num == 100) document.write("실행되었습니다.(true)");
else document.write("실행되었습니다.(false)");
}
결과보기
실행되었습니다.(true)
03. 다중 if문
{
const num = 100;
if(num == 90){
document.write("실행되었습니다.(num==90)");
} else if (num == 100){
document.write("실행되었습니다.(num==100)");
} else if (num == 110){
document.write("실행되었습니다.(num==110)");
} else if (num == 120){
document.write("실행되었습니다.(num==120)");
} else {
document.write("실행되었습니다.(num==값이없음)");
}
}
결과보기
실행되었습니다.(num==100)
04. 중첩 if문
{
const num = 100;
if(num == 100){
document.write("실행되었습니다.(1)");
if(num == 100){
document.write("실행되었습니다.(2)");
if(num == 100){
document.write("실행되었습니다.(3)");
}
}
} else {
document.write("실행되었습니다.(4)");
}
}
결과보기
실행되었습니다.(1)
실행되었습니다.(2)
실행되었습니다.(3)
실행되었습니다.(2)
실행되었습니다.(3)
'JavaScript' 카테고리의 다른 글
데이터 제어하기 - 3 (0) | 2022.04.13 |
---|---|
데이터 제어하기 - 2 (0) | 2022.04.13 |
데이터 실행하기 - 4 (0) | 2022.04.13 |
데이터 실행하기 - 3 (0) | 2022.04.13 |
데이터 실행하기 - 2 (0) | 2022.04.13 |