<head>
<title>=== 연산자와 !== 연산자</title>
<script type="text/javascript">
var str = "";
document.write(str == 0); // true => 관대하게 비교
document.write(str === 0); // false => 정확한 타입 비교
document.write("<hr />");
document.write(str != 0); // false
document.write(str !== 0); // true
document.write("<hr />");
document.write(null == undefined); // true
document.write(null === undefined); // false
</script>
</head>
<body>
<div>
== 연산자 보다는 === 연산자를 사용하자
</div>
</body>
'javascript' 카테고리의 다른 글
클래스 생성 (0) | 2011.11.25 |
---|---|
Call by value, Call by reference (0) | 2011.11.25 |
객체 생성 (0) | 2011.11.25 |
null과 undefined (0) | 2011.11.25 |
배열생성 및 인덱스 (0) | 2011.11.25 |