기본 콘텐츠로 건너뛰기

자바스크립트 null 비교하기

alert(null == undefined); //true
alert(null === undefined); //false
alert(true == 1); //true
alert(true === 1); //false
alert(true == '1');  //true
alert(true === '1'); //false
alert(0 === -0); //true
alert(NaN === NaN); //false
null과 undefined는 값이 없다는 의미의 데이터 형이다. null은 값이 없음을 명시적으로 표시한 것이고,

undefined는 그냥 값이 없는 상태라고 생각하자.

NaN은 0/0과 같은 연산의 결과로 만들어지는 특수한 데이터 형인데 숫자가 아니라는 뜻이다.

댓글

이 블로그의 인기 게시물

java 특정 디렉토리에 있는 파일 목록을 읽어내기, 정렬해서 가져오기

폴더 리스트 가져오기 String path="C:\"; File dirFile=new File(path); File []fileList=dirFile.listFiles(); for(File tempFile : fileList) {   if(tempFile.isFile()) {     String tempPath=tempFile.getParent();     String tempFileName=tempFile.getName();     System.out.println("Path="+tempPath);     System.out.println("FileName="+tempFileName);     /*** Do something withd tempPath and temp FileName ^^; ***/   } } 정렬해서 가져오기 import java.io.FileFilter; import java.io.IOException; import java.util.Arrays; import java.util.Date; import org.apache.commons.io.comparator.LastModifiedFileComparator; import org.apache.commons.io.filefilter.FileFileFilter; public class LastModifiedFileComparatorTest { public static void main(String[] args) throws IOException { File directory = new File("."); // get just files, not directories File[] files = directory.listFiles((FileFilter) FileFileFilter.FILE); System.out.println("Defaul...

UltraEdit Professional Version 18.20.0.1014 라이센스 키 넣기

Step 1: unpack rar archive      Step 2: run the setup   Step 3: Use the given keygen to activate    Add the line   127.0.0.1 licensing.ultraedit.com         to your %WINDOWS%\system32\drivers\etc\hosts file                 Enter any data for license-id and password (license-id must be a         number)                 Choose Offline activation and generate corresponding activation         codes for your user codes   Step 4: Enjoy and Support Developers, Buy It, They Deserved It!