Skip to content

Latest commit

ย 

History

History
19 lines (13 loc) ยท 1.15 KB

OrdinaryObjectCreate.md

File metadata and controls

19 lines (13 loc) ยท 1.15 KB

์ถ”์ƒ์—ฐ์‚ฐ OrdinaryObjectCreate

์ถ”์ƒ์—ฐ์‚ฐ abstract operation ECMAScript ์‚ฌ์–‘์—์„œ ๋‚ด๋ถ€ ๋™์ž‘์˜ ๊ตฌํ˜„ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ํ‘œํ˜„ํ•œ ๊ฒƒ

OrdinaryObjectCreate

Object.prototype์„ ํ”„๋กœํ† ํƒ€์ž…์œผ๋กœ ๊ฐ–๋Š” ๋นˆ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•œ๋‹ค

1. Object ์ƒ์„ฑ์ž ํ•จ์ˆ˜ ์‚ฌ์–‘

Object ์ƒ์„ฑ์ž ํ•จ์ˆ˜์— ์ธ์ˆ˜๋ฅผ ์ „๋‹ฌํ•˜์ง€ ์•Š๊ฑฐ๋‚˜ undefined, null์„ ์ธ์ˆ˜๋กœ ์ „๋‹ฌํ•˜๋ฉด์„œ ํ˜ธ์ถœํ•˜๋ฉด ๋‚ด๋ถ€์ ์œผ๋กœ ์ถ”์ƒ ์—ฐ์‚ฐ OrdinaryObjectCreate๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ Object.prototype์„ ํ”„๋กœํ† ํƒ€์ž…์œผ๋กœ ๊ฐ–๋Š” ๋นˆ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•œ๋‹ค

2. ๊ฐ์ฒด ๋ฆฌํ„ฐ๋Ÿด ํ‰๊ฐ€

์ถ”์ƒ์—ฐ์‚ฐ OrdinaryObjectCreate๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๋นˆ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ํ”„๋กœํผํ‹ฐ๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค

Object ์ƒ์„ฑ์ž ํ•จ์ˆ˜ ํ˜ธ์ถœ vs ๊ฐ์ฒด ๋ฆฌํ„ฐ๋Ÿด์˜ ํ‰๊ฐ€

  • ์ถ”์ƒ์—ฐ์‚ฐ OrdinaryObjectCreate๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๋นˆ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.
  • ์„ธ๋ถ€๋‚ด์šฉ์€ ๋‹ค๋ฅด๋‹ค(new.target ํ™•์ธ์ด๋‚˜ ํ”„๋กœํผํ‹ฐ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ์ฒ˜๋ฆฌ ๋“ฑ )
  • ๊ฐ์ฒด ๋ฆฌํ„ฐ๋Ÿด์— ์˜ํ•ด ์ƒ์„ฑ๋œ ๊ฐ์ฒด๋Š” Object ์ƒ์„ฑ์ž ํ•จ์ˆ˜๊ฐ€ ์ƒ์„ฑํ•œ ๊ฐ์ฒด๊ฐ€ ์•„๋‹ˆ์ง€๋งŒ, ๊ฐ€์ƒ์ ์ธ ์ƒ์„ฑ์ž ํ•จ์ˆ˜ Object๋ฅผ ์ƒ์„ฑ์ž ํ•จ์ˆ˜๋กœ ์ƒ์„ฑํ•˜๋ฏ€๋กœ(Object.prototype ์ ‘๊ทผ๊ฐ€๋Šฅ) ๋ณธ์งˆ์ ์œผ๋กœ ํฐ ์ฐจ์ด๋Š” ์—†์Œ