▶ 조건문 - if , else > SCRIPT

본문 바로가기
사이트 내 전체검색

SCRIPT

▶ 조건문 - 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

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

공지사항
자유게시판
질문답변
1:1문의

 

별명 : 터푸가위
주소 : 부산시 동래구 명장로20번길 90
대표 : 박규태
메일 : dancepkt@******.com

접속자집계

오늘
141
어제
285
최대
10,760
전체
277,747
Copyright © dancePKT . All rights reserved.