literals - ChoDragon9/posts GitHub Wiki

๊ฒฐ๋ก 

https://twitter.com/BrendanEich/status/1339614885953511424?t=7lujMcxc5d3nENAyYdx2Mg&s=19

var undefined = void 0 ์‚ฌ๋ก€

์ดํ›„ undefined์— ๊ฐ’์„ ํ• ๋‹นํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ void 0์„ ์‚ฌ์šฉํ•˜๋ผ๋Š” ๋‹ต๋ณ€๋„ ์žˆ์—ˆ์Œ (๋งํฌ)

๊ฐœ๋ฐœ์ž๋“ค์ด var undefined = void 0; ์„ ์‚ฌ์šฉ ์ค‘์ด๋ผ ํ•˜์œ„ ํ˜ธํ™˜์„ฑ์„ ์œ„ํ•ด undefined๋ฅผ global object์— ์ถ”๊ฐ€ํ–ˆ์Œ.

undefined์— ๋Œ€ํ•ด์„œ

undefined๋Š” global object์— ์ •์˜๋˜์—ˆ๋Š”๋ฐ, null์€ literal์— ์ •์˜ํ•œ ์ด์œ ๊ฐ€ ๋ฌด์—‡์ผ๊นŒ

https://2ality.com/2021/01/undefined-null-revisited.html

  • null์€ Java์˜ null literal ์ŠคํŽ™์„ ๊ฐ€์ ธ์™”์œผ๋ฏ€๋กœ null์ด literal์— ์ •์˜๋˜์—ˆ์Œ
  • ๊ณ ๋ฏผ์„ ๋‹ค์‹œ ์ƒ๊ฐํ•ด๋ณด๋ฉด undefined๋ฅผ global object์— ์ •์˜ํ•œ ์ด์œ ๊ฐ€ ํ•„์š”ํ•˜๋‹ค

null์€ literal์— ์ •์˜๋˜์—ˆ๋Š”๋ฐ, undefined๋Š” global object์— ์ •์˜ํ•œ ์ด์œ ๊ฐ€ ๋ฌด์—‡์ผ๊นŒ?

https://www.ecma-international.org/publications-and-standards/standards/ecma-262/

  • ES3๋ถ€ํ„ฐ Value properties of the Global Object ์ŠคํŽ™์— undefined ์ถ”๊ฐ€๋จ

TC39 ์งˆ๋ฌธ ํ›„ ๋‹ต๋ณ€

https://es.discourse.group/t/why-undefined-is-not-literals/1489

If you mean that undefined is not a keyword, and null is - I'm not sure why this was originally the case, but changing it now (or likely even back in ES3) would break the web.

https://github.com/tc39/ecma262/issues/2932

This was already asked on discourse: https://es.discourse.group/t/why-undefined-is-not-literals/1489/3 and that's the only proper place to ask.

global object

https://exploringjs.com/deep-js/ch_global-scope.html#conclusion-why-does-javascript-have-both-normal-global-variables-and-the-global-object

์ŠคํŽ™ ๋ฌธ์„œ

null ์ŠคํŽ™

https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#prod-Literal

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#literals

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null

undefined ์ŠคํŽ™

https://tc39.es/ecma262/multipage/global-object.html#sec-undefined

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined

https://developer.mozilla.org/en-US/docs/Glossary/Global_object