GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing ko.javascript.info — 비교

  • 튜토리얼
  • 코어 자바스크립트
  • 자바스크립트 기본
  • 비교 연산자
돌아가기

비교

중요도: 5

아래 표현식들의 결과를 예측해보세요.

5 > 4
"apple" > "pineapple"
"2" > "12"
undefined == null
undefined === null
null == "\n0\n"
null === +"\n0\n"
5 > 4 → true
"apple" > "pineapple" → false
"2" > "12" → true
undefined == null → true
undefined === null → false
null == "\n0\n" → false
null === +"\n0\n" → false

해설:

  1. 명백히 true입니다.
  2. 문자열의 비교는 사전순서가 기준이므로 false입니다. "a"는 "p"보다 작습니다.
  3. 두 피연산자는 문자열이므로, 사전순으로 비교가 이뤄집니다. 왼쪽 피연산자의 첫 번째 글자 "2"는 오른쪽 피연산자의 첫 번째 글자 "1"보다 큽니다.
  4. null과 undefined는 같습니다.
  5. 일치 연산자는 형도 체크합니다. 형이 다르면 false가 반환됩니다.
  6. (4)와 유사한 문제입니다. null은 오직 undefined와 같습니다.
  7. 형이 다르므로 false가 반환됩니다.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.