프로그래밍/Javascript
JavaScript Operator의 ===, !== 연산자
SeanYoon
2010. 12. 29. 12:31
반응형
===, !== 라는 연산자를 자주 봤었는데... 사용을 않하다 보니 모르고 살았다.
검색을 해보니... 아래와 같은 결과가...
일반적으로 javascript에서 == 을 하게 되면 값을 비교한다. 데이터 타입이 String, Int, Long 관계없이... 값만 같으면 true를 리턴했지만... === 3개짜리는 데이터 타입과 값이 같은 경우에 true를 리턴한다.
!== 는 당연히 반대겠죠~
=== This is the strict equal operator and only returns a Boolean true if both the operands are equal and of the same type. These next examples return true:
a === 2
b === 4
!== This is the strict not equal operator and only returns a value of true if both the operands are not equal and/or not of the same type. The following examples return a Boolean true:
a !== b
a !== "2"
4 !== '4'
검색을 해보니... 아래와 같은 결과가...
일반적으로 javascript에서 == 을 하게 되면 값을 비교한다. 데이터 타입이 String, Int, Long 관계없이... 값만 같으면 true를 리턴했지만... === 3개짜리는 데이터 타입과 값이 같은 경우에 true를 리턴한다.
!== 는 당연히 반대겠죠~
=== This is the strict equal operator and only returns a Boolean true if both the operands are equal and of the same type. These next examples return true:
a === 2
b === 4
!== This is the strict not equal operator and only returns a value of true if both the operands are not equal and/or not of the same type. The following examples return a Boolean true:
a !== b
a !== "2"
4 !== '4'
반응형