<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>
    <title>논리연산자</title>
</head>

<body>

<script language="javascript" type="text/javascript">
    // && 연산자(AND) :  둘 다 참일 때에만 참
    // || 연산자(OR) : 하나라도 참이면 참
    // ! 연산자(NOT) : 참이면 거짓으로, 거짓이면 참으로

    // true && true -> true
    document.write((10 > 5) && (5 != 3) + "<br />");

    // true ||false -> true
    document.write((10 >= 5) || (5 == 3) + "<br />");

    // !false -> true
    document.write(!(10 <= 5)); // true
</script>

</body>
</html>


< 실행결과 >




'.NET프로그래밍 > JavaScript 1.2' 카테고리의 다른 글

13. 대입연산자  (0) 2009.07.30
12. 조건연산자  (0) 2009.07.30
10. 관계연산자  (0) 2009.07.30
9. 산술연산자  (0) 2009.07.30
8. 변수선언초기화 참조  (0) 2009.07.30
Posted by holland14
: