.NET프로그래밍/JavaScript 1.2
11. 논리연산자
holland14
2009. 7. 30. 23:05
<!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>
< 실행결과 >