▶ 조건문 - if , else
페이지 정보
본문
<script>
var a = 5, b = 3;
// if 구문
if(a > b){
document.write("a가 크다.");
}
// if , else 구문
if(a > b){
document.write("a가 크다.");
}else{
document.write("a가 b와 같거나 작다.");
}
// if , else if , else 구문
if(a > b){
document.write("a가 크다.");
}else if(a < b){
document.write("a가 b보다 작다.");
}else{
document.write("a와 b는 같다.");
}
// if , else 구문 둘중 안에 다시 if , else 구문
if(a > b){
document.write("a가 크다.");
}else{
if(a == b){
document.write("a와 b는 같다.");
}else{
document.write("a가 b보다 작다.");
}
}
</script>
추천0 비추천0
- 이전글prompt() 예제 21.07.16
- 다음글prompt() - 점수 입력 받은후 학점 츌력 21.07.16
댓글목록
등록된 댓글이 없습니다.