์ฅ๋ฐ๊ตฌ๋์ ์ํ์ด ์์ต๋๋ค.
home2 › ๊ฒ์ํ › Node.js, Express ๊ฒ์ํ › Cannot read properties of undefined (reading 'name')
name์ด DB์ ์๋๋ฐ ์ ์๋์ง ์์ ์์ฑ์ ์ฝ์ ์ ์๋ค๊ณ ํฉ๋๋ค.. ์ด์ ๊ฐ ๋ฌด์์ผ๊น์?
result๋ผ๋ ๋ณ์์ ์๋ฌด๊ฒ๋ ์๊ฑฐ๋ ์๋ฒ์์ ์๋ณด๋ด๊ณ ์๊ฑฐ๋ ๊ทธ๋ฐ๊ฒฝ์ฐ๊ฐ๊ตฐ์
console.log()๋ก ์ถ๋ ฅํ ๋๋ ์๋๋๋ฐ ์ result.nameํ๋ฉด undefined๊ฐ ๋๋์?
result๋ณ์๋ฅผ ejs๋ก ๋ณด๋ด๋ ๋ฌธ๋ฒ์ด ์ด์ํ๋ฏ์
/lsit์ result์ ์ฃผ๊ธฐ๋ก ํ๋๋ฐ, ejs์์ ํ console.log()์์๋ undefined๊ฐ ์ถ๋ ฅ๋ฉ๋๋ค ์ด์ ๊ฐ ๋ฌด์์ผ๊น์?
๊ฐ์ฌํฉ๋๋ค ํด๊ฒฐ๋์์ต๋๋ค