Skip to content

Instantly share code, notes, and snippets.

@healim
Created July 23, 2018 07:57
Show Gist options
  • Save healim/4b5e19efc1929fd731c4f2d63340189f to your computer and use it in GitHub Desktop.
Save healim/4b5e19efc1929fd731c4f2d63340189f to your computer and use it in GitHub Desktop.
null 활용

null 활용

let headings = null;

값 할당 안 된 변수에 null 처리

  • 소소하게 좋은 점
    • const 쓸지, let 쓸지 판단하기 좋다.
  • 눈에 띄게 좋은 점
    • undefined 나왔을 때 프로세스를 거쳤는지 안 거쳤는지 알기 쉽다
      • null 미리 할당 해줬으면 프로세스는 거쳤는데 도중에 문제가 있다는 소리고, undefined는 거친 적도 없다는 소리니까 버그 고칠 때 참고할 수 있는 정보가 됨
const data = [
  {
    when : '2 mins age',
    who : 'dotori',
    description: 'created new account'
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment