• 회원가입
  • 로그인
  • 구글아이디로 로그인

[Operator] JS - in 연산자 (in Operator = 포함연산자)

in 연산자

 

지정 속성이 지정 객체에 있으면 true 반환. 그렇지 않으면 false 반환.

 


 

<p id="demo"></p>


<script>

var hz = ["홈짱닷컴", "Homzzang.com", "2012"]; // 배열

var code = {html:"기본틀", css:"디자인", js:"기능"}; // 객체


document.getElementById("demo").innerHTML =

  // 배열

  ("홈짱닷컴" in hz) + "<br>" + // false

  (0 in hz) + "<br>" + // true

  (1 in hz) + "<br>" + // true

  (4 in hz) + "<br>" + // false

  ("length" in hz) + "<hr>" + // true

  

  // 객체

  ("html" in code) + "<br>" + // true

  ("js" in code) + "<hr>" + // true


  // 미리 정의된 객체

  ("PI" in Math) + "<br>" + // true

  ("NaN" in Number) + "<br>" + // true

  ("length" in String); // true

</script>

 

결과보기



분류 제목
Operator JS - typeof 연산자 - 데이터타입 반환/확인/체크 (= typeof연산자 = 타입어브연산자/타입어브…
Operator JS - delete 연산자 (delete Operator = 삭제연산자)
Operator JS - in 연산자 (in Operator = 포함연산자)
Operator JS - instanceof 연산자 (instanceof Operator = 인스턴스연산자)
Operator JS - void 연산자 (= void Operator = 보이드 연산자) + 클릭 배경색 변경
Statement JS - 구문 (Statements)
Statement JS - break 구문 ★ (= break문 = 브레이크문)
Statement JS - continue 구문 ★ (= continue문 = 컨티뉴문)
Statement JS - debugger 구문 (= debugger문 = 디버거문)
Statement JS - do ... while 구문 (= 두와일구문 = 두와일문 = 두와일반복문)
Statement JS - for 구문 (= for문 = 포구문 = 포문 = 포반복문)
Statement JS - for...in 구문 (= 포인구문 = 포인문 = 포인반복문)
Statement JS - function 구문 (= 함수구문)
Statement JS - if ... else if ... else ... 구문 (= if문 = 이프문 = 이프조건문)
Statement JS - return 구문 ★★ (= return문 = return구문 = 리턴문 = 반환문 = 리턴구문)…
Statement JS - switch 조건문 ★ (= switch문 = 스위치문)
Statement JS - throw 구문 (= 쓰로우문 = 쓰로우구문)
Statement JS - try ... catch ... finally 구문 (= 트라이캐치파이널구문)
Statement JS - var 구문 (= 변수정의)
Statement JS - while 구문 (= 와일문 = 와일반복문)
9/67
목록
찾아주셔서 감사합니다. Since 2012