λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
JavaScript/JavaScript

[JavaScript] undefined, null, undeclared

by μ½”λ”©ν•˜λŠ” λΆ•μ–΄ 2021. 11. 5.
λ°˜μ‘ν˜•

πŸ„ undefined (λ―Έμ •μ˜ λ³€μˆ˜)

  1. 값을 λŒ€μž…ν•˜μ§€ μ•Šμ€ λ³€μˆ˜, 즉 데이터 μ˜μ—­μ˜ λ©”λͺ¨λ¦¬ μ£Όμ†Œλ₯Ό μ§€μ •ν•˜μ§€ μ•Šμ€ μ‹λ³„μžμ— μ ‘κ·Όν•  λ•Œ
  2. 객체 λ‚΄λΆ€μ˜ μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” ν”„λ‘œνΌν‹°μ— μ ‘κ·Όν•˜λ €κ³  ν•  λ•Œ
  3. return문이 μ—†κ±°λ‚˜ ν˜ΈμΆœλ˜μ§€ μ•ŠλŠ” ν•¨μˆ˜μ˜ μ‹€ν–‰ κ²°κ³Ό

 

πŸ„ null

μ‚¬μš©μžκ°€ λͺ…μ‹œμ μœΌλ‘œ 'μ—†μŒ'을 ν‘œν˜„ν•˜κΈ° μœ„ν•΄ λŒ€μž…ν•œ κ°’
nullμ΄λΌλŠ” 빈 값을 ν• λ‹Ήν•˜λ©΄ ν•΄λ‹Ή λ³€μˆ˜μ˜ νƒ€μž…μ€ 객체가 λœλ‹€.

 

πŸ„ undeclared (λ―Έμ„ μ–Έ λ³€μˆ˜)

λ³€μˆ˜ μ„ μ–Έμ‘°μ°¨ λ˜μ–΄ μžˆμ§€ μ•Šμ€ μƒνƒœ

λ°˜μ‘ν˜•

λŒ“κΈ€