- ํ๋กํผํฐ๊ฐ ์๋ ์ค์ฒฉ ๊ฐ์ฒด์ ์๋ฌ ์์ด ์์ ํ๊ฒ ์ ๊ทผ
- ๋์์ด undefined๋ null์ด๋ฉด
undefined
๋ฐํ - ๋จ์ฉํ์ง ๋ง ๊ฒ
- ๋ฐ๋์ ์์ด์ผ ํ๋ ๊ฐ์ ๊ฐ์ด ์์ ๊ฒฝ์ฐ, ์๋ฌ๋ฅผ ํตํด ๋ฐ๋ก ๋ฐ๊ฒฌํด์ผ ํ๋๋ฐ ์๋ฌ๋ฅผ ๊ฐ์ถ๋ฏ๋ก ๋๋ฒ๊น ์ด ์ด๋ ค์ธ ์ ์๋ค.
const fish = null;
//console.log(fish.type); // Cannot read property 'type' of null
console.log(fish && fish.type); // null
console.log(fish?.type); // undefined